Mobile app version of vmapp.org
Login or Join
Deb1703797

: Prevent Google Indexing SubDomains I have cPanel Hosting with only 1 IP. I'm in the process of pointing all my TLDS over to this server. I have created 'Addon Domains' and all the folders

@Deb1703797

Posted in: #Domains #Google #Htaccess #Seo #Subdomain

I have cPanel Hosting with only 1 IP. I'm in the process of pointing all my TLDS over to this server.

I have created 'Addon Domains' and all the folders from which it creates are located in sub directories 'domain1.com' , 'domain2.com' in my root website '/home/user/public_html/client/' but they can be accessed from 'domain1.maindomain.com'. The thing that is worrying me is if google indexes these subdomains.

What can I do to prevent this, would a rewrite rule like this be sufficient?


RewriteEngine on RewriteCond
%{HTTP_HOST} !^www.domainpointtosubfolder.com$ [NC] RewriteRule
^(.*)$ www.domainpointtosubfolder.com/ [L,R=301]


Or is there a better way?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Deb1703797

2 Comments

Sorted by latest first Latest Oldest Best

 

@Jamie184

Google, like all decent web crawlers, honors Robots Exclusion Standard (robots.txt). If there really is a limitation not to use separate folders for every domain and you don't want to treat all domains as cPanel "Add on domains", you could prevent the indexing of these folders (but not access to the folders) by adding /home/user/public_html/client/robots.txt:

User-agent: *
Disallow: /site1-directory/
Disallow: /site2-directory/


As the additional domains have different roots, this robots.txt will only affect the main site.

10% popularity Vote Up Vote Down


 

@Megan663

If you don't use cPanel, the correct way to do this is to put each of domain into is very own directory. Apache is not really designed to handle overlapping domains the way that cPanel sets things up. This seems to be a limitation of cPanel.

One technique that should work is to treat all of your domains as "add on domains." Set your main domain name in cPanel to a subdomain that doesn't actually have a DNS entry. Something like allmysites.example.com. Then Google can't actually crawl the main directory at all. Your directory structure would then look like:


allmysites (serves allmysites.example.com which isn't accessible through DNS)

site1 (serves site1.example.com)
site2 (serves site2.example.com)
site3 (serves site3.example.com)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme