So here’s the scenario: You created a website, or let’s say a blog, and decided to use a subdomain instead of your top-level domain for various reasons you do not understand. After a couple of weeks and Google crawls, you realize that Alexa is having a hard time reading analytics of websites using subdomains unknown to it (in contrast to the likes of Blogspot.com and WordPress.com) and it is not recommended especially that your website is not really a subset of your top-level domain like you thought of. It thus dawned on you to transfer your entire website from the current subdomain to its parent domain facing the dilemma that you have allowed Google to crawl your website. Changing the domain would seriously affect the influx of your visitors as Google searches would subsequently end up as a bunch of useless links and 404s. Not to mention your backlinks.
That’s what happened to me at least.
At first it didn’t concern me so much because I thought that Google would just re-crawl it but then I learned that it takes a few weeks before it returns to crawl a website. Also, there might be a possibility that the dead links that Google had indexed may not be removed. It might think that these links were just duplicate URLs of my content. So the question was: How do you tell Google that you changed address and re-index your website?
In Webmaster Tools Help I found this page that tells you exactly what to do when you decide to move your website. The second item is the solution to reclaim all the dead links from my subdomain to the parent domain – 301 Redirect.
301 Redirect tells search engines and users that your site has permanently moved, which is exactly what I needed. I ended up with a pretty simple solution from this post.
In my subdomain’s root folder where my website was located I created an .htaccess file that contains the code that performs permanent 301 Redirects to my parent/new domain:
# This allows you to redirect your entire website to any other domain Redirect 301 / http://karlmac.com/
Yes, it was this blog. This blog’s address was blog.karlmac.com and was transferred to karlmac.com. Anyway, the code above is the contents of the .htaccess file. It performs a 301 Redirect from the root of my subdomain (/) to the specified new domain (http://karlmac.com), which in this case is its parent domain. It is also worth noting that the directories in the website was intact.
After this I tested it by searching my website on Google. The old addresses came up but when I clicked them, the URL was reconciled to the parent domain and redirected accordingly. Happiness ensued. Re-crawling may not happen anytime soon (It surely will, eventually), but I was assured that all the old links are properly redirected to the intended content.
I hope that by sharing my experience (or rather my lack of it) helped you in some way. Cheers!