Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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
^(.*)$ http://www.domainpointtosubfolder.com/$1 [L,R=301] 

Or is there a better way?

share|improve this question

1 Answer 1

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)
share|improve this answer
    
Just to make this clear: Subdomain 'public_html/clients/' 'client.mydomain.com' - serves site1 (site1.mydomain.com) 'public_html/clients/site1.com/' Should I delete all the DNS records for this main subdomain? –  tom Dec 15 '13 at 17:36
    
You shouldn't delete DNS records for anything. All your DNS records should still point to your server. You should just configure cPanel to serve nthoaesuoaeuaou.example.com from public_html and create a add on domain for your main site. –  Stephen Ostermiller Dec 15 '13 at 18:10
    
I've created a subdomain which stores all my addon domains will that be ok? Not able to make a 'AddOn' for my main site, conflicts in DNS or something. –  tom Dec 15 '13 at 18:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.