Hi, I am converting my static HTML site to WordPress. So I will need to make sure that I 301 all my old pages. My HTML pages were all of the format: http://www.domain.com/page1.html I plan on converting each such page to a WordPress post which will have a URL like: http://www.domain.com/categoryname/page1/ I have two questions I hope you can help me with: 1) Since I am not changing the domain name, would my 301 redirect in the .htaccess be: redirect 301 /page1.html http://www.domain.com/categoryname/page1/ OR redirect 301 /page1.html /categoryname/page1/ (i.e. not the full URL) 2) My understanding is that I will need to put an entry each for all the pages. Is that right? redirect 301 /page1.html http://www.domain.com/categoryname/page1/ redirect 301 /page2.html http://www.domain.com/categoryname/page2/ redirect 301 /page3.html http://www.domain.com/categoryname/page3/ redirect 301 /page4.html http://www.domain.com/categoryname/page4/ redirect 301 /page5.html http://www.domain.com/categoryname/page5/ … Thanks for your help. Ajeet
Hi instead use a ReWriteCond, and ReWriteRule to redirect your old urls. RewriteRule (.*)\.html$ http://www.domain.com/categoryname/$1 [R=301,L] Try it. I hope it will work...
Thanks for that Imran. What I am worried about is the fact that the new URLs have a trailing "/" while the old URLs did not. Will that be taken care of with the above redirect?
Fabulous. Thanks. The only thing is that to make this syntax work, I had to use the same categoryname in the URL http://www.domain.com/categoryname/ Any way around that. Thanks (green rep coming your way
Or you can keep the same URL structure in wordpress. Like http://www.domain.com/page1.html Simple change the permalinks structure in your wp dashboard.
To make use of Wordpress SEF urls it is better to have a different structure. The above syntax will change for Categories with different names. Give me a category structure that you have and want to have in new wordpress. I will give it a try again.
Okay, suppose these are the redirections from my html site to WP site, then how would the redirections work? http://www.domain.com/page1.html redirects to http://www.domain.com/categoryONE/page1/ http://www.domain.com/page2.html redirects to http://www.domain.com/categoryTWO/page2/ http://www.domain.com/page3.html redirects to http://www.domain.com/categoryTWO/page3/ http://www.domain.com/page4.html redirects to http://www.domain.com/categoryTWO/page4/ http://www.domain.com/page5.html redirects to http://www.domain.com/categoryTWO/page5/ http://www.domain.com/page6.html redirects to http://www.domain.com/categoryTHREE/page6/ http://www.domain.com/page7.html redirects to http://www.domain.com/categoryTHREE/page7/ Thanks
Though there is a answer to this from htaccess, but there is a wordpress plug-in which does this quite easily. http://wordpress.org/extend/plugins/redirection/ have you checked with this plugin it is compatible upto 3.0.