I have a new client with an old and new web site, who asked me yesterday how to redirect one to the other. I knew that I should use a 301 permanent redirect, but oddly enough, I wasn’t sure where to put the .htaccess file.
In the past, I’ve only ever used a 301 or 302 redirect for files on the same server. I guess that might sound dumb, but I didn’t know if the .htaccess file should go on the old site’s server or the new one, and I looked around for half an hour on Google and couldn’t find the answer to that question.
So I’m posting what I found out here – if you change your domain name and redirect Site A to Site B, the .htaccess file (assuming you’re using Apache server) needs to sit on Site A, kind of like a detour sign. And if you’re trying to recapture good rankings from the old site, leave it up for awhile, like up to a year. This will give the search engines plenty of time to get the new pages indexed (and for your visitors to change bookmarks) before you take the old site down.