If you have decided to change your site’s domain and are hosting your old site on an Apache server, then redirecting traffic to the new site is relatively simple. The most important aspect of the move is to ensure that you don’t lose visitors and that you don’t lose any existing rankings with the search engines. A 301 redirect, or permanent redirect, will ensure that both human visitors and search engines alike are automatically and seamlessly pointed to the new domain.
Below is the code that you should place in your .htaccess file on the old site:
Obviously, you will need to replace the instances of olddomain and newdomain with your actual domain names and if your site isn’t a .com site, then that will need to change as well.
One thing to keep in mind when moving to a new domain is that the rule above will take a visitor to the equivalent URL on the new domain. In other words, if a user goes to http://www.olddomain.com/articles/about-me.html
, then they will be redirected to http://www.newdomain.com/articles/about-me.html
. But what happens if you actually moved that page to http://www.newdomain.com/about-me.html
when you made the move to the new domain? Then you will have to add additional redirects to your .htaccess file to ensure that visitors are directed to the appropriate pages for these altered locations. Because of this, it is highly recommended that you don’t try to restructure your site at the same time that you make the move from one domain to another. One reason that this is a bad idea is because if something goes horribly wrong with your SEO, you won’t know whether it was because of the domain change or because of the site restructure.
Oh, and please be aware that your browser caches 301 redirects, so it is best to start with a 302 redirect when testing.