views:

39

answers:

2

I'm trying to redirect an old wordpress blog to a new posterous blog using an htaccess file and I am using the code below; the problem is that I can't get the old individual blog posts to redirect to the new ones - they have the same name structure on the new domain name (eg: olddomain.com/post-1 is now newdomain.com/post-1), but if I type in one of the old post urls I get a 500 error. My home page, category and index pages are all redirecting fine as well as the 301 redirects at the bottom for the old wordpress page urls. What am I doing wrong?

Options +FollowSymlinks  

<IfModule mod_rewrite.c>  
RewriteEngine On  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule ^category/(.*)$ http://newdomain.com/tag/$1 [R=301,L]  
RewriteRule ^page/(.*)$ http://newdomain.com/\?page=$1 [R=301,L]  
RewriteRule . /index.php [L]  
RewriteCond %{HTTP_HOST} ^www.olddomain.com [nc,or]  
RewriteCond %{HTTP_HOST} ^olddomain.com [nc,or]  
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,nc]  
</IfModule>  

redirect 301 /page-1 http://newdomain.com/page-1  
redirect 301 /page-2 http://newdomain.com/page-2  
redirect 301 /page-3 http://newdomain.com/page-3  
A: 

You need to do:

RedirectPermanent /old_page http//www.newawesomesite.com/old_page

bvandrunen
where should I put that code? won't that just replace the 'redirect 301 /page-1 http://newdomain.com/page-1' that I'm curently using (which works). The issue seems to be that 'RewriteRule . /index.php [L]' is breaking the sitewide redirect, but if I remove this then it breaks the 301 redirects.
Edward
A: 

I got it to work by replacing old individual page redirect code:
redirect 301 /page-1 http:// newdomain .com/page-1

with new rewrite rules:
RewriteRule ^page-1/?$ http:// newdomain .com/pages/page-1 [R=301,L]

and placing the page these rules above the directory and site wide rules. Note: you need to remove the spaces from the newdomain url which I had to add as new users on the site can't add urls to their posts.

Edward