Search Engine Optimization

SEO Case Study: Apache, .htaccess and 301 Redirects

7 Aug , 2008  

If you’re thinking about changing domain names, or moving or renaming all the files on your website, then you probably have come across more than one person telling you to put 301 redirects in your .htaccess file.  This will tell search engines, and your visitors’ browsers, that your website content has moved to a new location.  I recently had to do this, and I thought I’d share what effect it had on the site and how it’s worked out for me.

I had to change a domain name due to copyright infringement, let’s say from old-domain.com to new-domain.com. The site was only about 2 months old when the July PageRank update came out last week, and it had about 500 backlinks and the home page was given a PageRank of 2. Only about 100 links were to the home page, the rest were all deeplinked to various content pages within the site. I had registered the domain with Google Webmaster Tools and I was monitoring the backlinks, to make sure they were all being reported. So when I bought the new domain I also registered it with Google Webmaster Tools, and it reported Zero backlinks, as expected. 

For anyone unaware, a 301 redirect is a rule applied in the .htaccess file on Apache webservers which tells anyone visiting a website at old-domain.com to be automatically redirected to the new domain, new-domain.com. 301 is the status code passed in the http header (200 is the code for OK, 404 for page not found, etc.)

About a week ago or so, coincidently the same time the PageRank update came out, I had to add the 301 redirect.  I applied a domain change, which is site-wide, so it also works for all deeplinked pages. If you either followed a link to, or typed in, old-domain.com/mypage.html, you would be seamlessly redirected to new-domain.com/mypage.html. For the most part this is transparent to the user, unless they happen to look into the address bar in their browser and notice the domain has changed.

OK, so a week later, after the 301 redirect is in place, what has it done to the site’s SEO factors?

Well, the Google Toolbar PageRank did not transfer. Whether you visit the old domain and are redirected, or if you visit the new domain directly, the PageRank is greyed out; nonexistent. This was an expected result. Google updates all domains’ pagerank at the exact same time, they don’t do a special update just for people who have to use 301s. That doesn’t mean the PageRank hasn’t transfered behind-the-scenes, it just means the Google Toolbar is not showing it.

Interestingly, though, in Google Webmaster Tools just about all the links have been moved to the new domain. Remember I said I had 500 backlinks in there? Well all but about 40 of them have been moved to the new domain in the Google Webmaster tool’s external link list. I didn’t edit them or change the links; some of these links are over a month old and all point to the old domain. But even though these links are actually pointing to the old domain, Google reports them as being applied to the new domain, thanks to the 301 redirect. That means that any PageRank or authority which those links are passing will now be applied the new domain.

But what about keywords in the SERPs and indexing? Here it is a week later, and I ran a site:old-domain.com and site:new-domain.com query. All of the site’s pages are indexed with the new domain, and appear with the query site:new-domain.com. About 7 pages are still lingering in the Google index with the old domain. I picked a few keywords from Google Analytics from a month ago, which I knew worked with the old domain, and they are still performing with the new domain, in roughly about the same position in the SERPs (give or take a spot).

All this leads me to believe that behind the scenes Google is applying the PageRank to the new domain, even though it’s not showing in the toolbar.  I’ll keep you updated on this, but as of right now the site is performing just as it had before the domain change and the 301 redirects were in place.

, , , , , , , ,


2 Responses

  1. Achim says:

    Thanks a lot for this report – I have to do a big relaunch which will change 99% of all paths, about 200,000 in total. :) So it’s good to hear that the 301 redirect works.

  2. g1smd says:

    The Toolbar data is updated about every 3 or 4 months, and the data is some 2 or 3 months old when it updates. So no, you wouldn’t see the ToolBar PageRank change for quite a long time yet.

Comments are closed.

SEO Case Study: Apache, .htaccess and 301 Redirects

by Barry Wise time to read: 3 min
2