Forum Moderators: phranque
So far, I've been 301 redirecting the individual product pages to their equivalent on the new site, along with a few main category pages. My .htaccess file on the old site is as long as my arm.
At the moment, I'm poised-ready to redirect the remaining main pages to their counterparts, and then implement the redirect of the entire domain.
I have two questions.
#1: Is the correct way to implement the final 301:
redirect 301 / [newdomain.com...]
?
And if so, do I want to place it at the bottom of my .htaccess file so all the previous redirects will still be read? Or does it even matter?
Thanks!
The correct placement depends on what you want.
If you want the previous redirects to keep redirecting to the current 'new' site, then the final 'catch all' redirect should be last.
If you would like to just use the 'catch all' to redirect everything then you should put it first.
So, really the correct placement is based on the desired effect.
I don't work with Redirect much, but the code appears to need a trailing / on the URL being Redirected to:
redirect 301 / http://www.newdomain.com/
Hope this helps.
Justin
Redirect 301 / http://www.newdomain.com/ is correct.
This will redirect each page on the old domain to the corresponding page on the new domain, assuming the domains are separately hosted. Any URL-path with a prefix that matches that given on the left will be redirected to the same URL-path on the new domain.
This is done by removing the prefix given on the left from the requested URL, and adding the remainder of the requested URL to the canonical URL prefix on the right. If you omit the trailing "/", then a request for olddomain.com/index.html would be redirected to newdomain.comindex.html, which obviously wouldn't work.
If the domains both resolve to the same "account" on the same server, and you have no access to httpd.conf, then you'll need to use mod_rewrite to test the requested domain and redirect only if the old domain is requested.
Jim