Preventing Search engines from indexing your sub domains

Web Hosting Nigeria

Home | Shared hosting | ( 1 ) | Subscribe

Posted by on Thursday April 3, 2014 at 17:49:11:

Unless you are actually using all those domains are one site and won't amount to duplicate content on individual sites, it won't really make sense to allow search engines like Google to index your sub domains if you are simply using a shared hosting to host multiple sites that are not linked to each other.

One of the reasons why I use shared hosting to host my growing number of sites is because it saves me the extra money I would have paid if I were to set up a different web hosting place for each website that I setup.

With Shared hosting, one could just pay for a single hosting and then just pay only for domain names when launching multiple sites in the future.

However, I noticed a problem on my Bluehost hosting service which was simply amounting to creating duplicate content on search engines like Google and this may affect my search engine ranking for those sub sites or the main site.

Imagine if you have a primary website like mainsite.com and then you use that shared hosting plan to setup another site like subsite.com. Ordinarily, Bluehost sets up sub domains for each of the add on domain that you use and park with your hosting service. Each of those sub domains tend to get indexed by Google as well as the domain itself. It play out such that the sub domain subsite.mainsite.com and the domain subsite.com both get indexed in search engines and this is not good for your site if you care about S.E.O.

I noticed that both my Sub domains hosted on Bluehost as well as my main domains were both showing up in search engine results and this is simply not good for SEO.

I had to try and Google out a way just to ensure that even though the sub domain exists, It would no longer be indexed by search engines.

I was not able to do it from the robots text file but was able to do it from the .htaccess file located in the web folder.

The solution is just to create a Permanent 301 redirect in your .htaccess file to redirect the sub domains to the main site and as such, the indexed record would be removed from Google results.

For now, it seems to work well and it would only be a matter of time for Google to delist those sub domains. I'm not yet sure how it would affect my web hosting service for things such as visitor logs and so on.

How to do it
===========
- Open up the .htaccess file
- Enter the following:


RewriteEngine on

RewriteCond %{HTTP_HOST} ^subsite.mainsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.subsite.mainsite.com$
RewriteRule ^(.*)$ "http\:\/\/www\.subsite\.com\/$1" [R=301,L]




Comments: