Redirect your whole domain to a new domain with a 301 redirect through the .htaccess file

Posted by on January 29, 2013 in Apache, Web Servers | 0 comments

The great thing about SEO is that it’s all tied to your domain name and not an IP address of the server where your files are being stored. However, being tied to a domain name hurts you in some situations as well. Consider if someone started a website on a free site, like WordPress.com and built up a fairly large following and some good SEO power. Now their domain is something like myblog.wordpress.com. This isn’t great from a professional look standpoint. Let’s say they think they can make a little money off advertising if they host their website on their own domain. Yes they have the following, but if they get their own domain name, they’ll loose all that SEO power that they’ve built up. This is where 301 redirects come in. If you have access to the .htaccess file on the webserver, you can quickly put a redirect in place so that Google will transfer (most) of the power that has been accumulated to the next domain. Notice that the method below only works if you are keeping the same URL structure on the new domain.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.org
RewriteRule (.*) http://www\.example\.org/$1 [R=301,L]

Just throw that into the .htaccess file and you’ll get redirected to the same page on the new domain. This helps you in two ways. The first is the Google will transfer your power to the new domain, and secondly, anyone following links they may have found on the web will get to the new domain too. Ideally, you should also start building up power to the new domain as well as not all of the power will get transferred.

Keep in mind if you have advanced control over your server you can also put this into the apache config files instead of the .htaccess. Either way, the redirect says the same thing, I moved permanently.

Now if you are moving your website, it’s a good idea to let Google know about it. The first way is to submit a site map to Google of BOTH domains through webmaster tools. This means that Google will go back and crawl your old site and see all of your redirects to the new page. They should after that begin the process of transferring the SEO power. The site map of the new site just means that Google will see all of your new content on the new domain. A site map is a good idea anyways to submit just so Google knows about ALL of your content and it can decide how to index it appropriately.

Notice that it shouldn’t take too long to start the process of Google transferring the SEO power, but for the redirects to work properly, you need to maintain control over the old domain. If you delete your account, or stop paying for the domain name, you’ll loose the traffic from all the links that have been built to the old domain. This is why it’s essential that you build new links to your new domain.

There are numerous other things that you should keep in mind when transferring domains, but this is the best way I’ve found to hold onto the power that Google has already established on your old domain. As I’ve said, it only works on a simple move. If you’ve renamed files, you’ll need to have a 1:1 redirect for every page on your old domain to every new page on your new domain name. It’s alot safer to do a simple move where everything is named the same because you don’t run the risk of loosing any files. Also, if you have WordPress as your CMS, if you want to change the naming system of your permalinks, it automatically adds redirects for you. That’s great news on the risk front because even if someone is redirected to the old filename, it will automatically redirect them to the new filename. If you’re not running a CMS, or you changed your CMS, it’ll be a little hard to keep track of everything, but it’s well worth it to maintain the SEO power you’ve already accumulated.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>