hide addon domain from main domain

Discussion in 'Domain Names' started by riple, Apr 14, 2010.

  1. #1
    I have 2 domain example abcd.com as main domain and xyz.com as addon domain.
    I want to hide addon domain folder from main domain so visitor can't access abcd.com/xyz.com
    hosting on hawkhost. can you help me what can I do?
    thanks
     
    riple, Apr 14, 2010 IP
  2. eldiablo

    eldiablo Active Member

    Messages:
    200
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    80
    #2
    Talk to your hosting provider about that issue and they will sort it out for you.
    I think this is best solution...

    On the other hand, I've had hosting like that and it was set up on the other way, it was not possible to access xyz.com from abcd.com/xyz.com just when you type in xyz.com...

    Talk with hosting and they will solve it for you!
     
    eldiablo, Apr 14, 2010 IP
  3. webcosmo

    webcosmo Notable Member

    Messages:
    5,840
    Likes Received:
    153
    Best Answers:
    2
    Trophy Points:
    255
    #3
    all you need to do is use a proper .htaccess to make a redirect.
     
    webcosmo, Apr 14, 2010 IP
  4. Mystique

    Mystique Well-Known Member

    Messages:
    2,579
    Likes Received:
    94
    Best Answers:
    2
    Trophy Points:
    195
    #4
    There are three things to bear in mind to do what you want.

    The first is don't add your addon domain subdomain folder to the robots.txt because that is the fastest way search engines find it whether they index it or not (some wil ignore your robots.txt rules)

    The second is doing an .htaccess redirection in the root directory this way
    
    RewriteEngine On
    RewriteBase / 
    RewriteCond %{HTTP_HOST} ^abcd.com/addon-domain-directory$ [OR]
    RewriteCond %{HTTP_HOST} ^www.abcd.com/addon-domain-directory$ [OR]
    RewriteCond %{HTTP_HOST} ^xyz.abcd.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.xyz.abcd.com$
    RewriteRule ^/?$ "http\:\/\/www\.xyz.\.com\/" [R=301,L]
    
    Code (markup):
    And finally upload another .htaccess to your addon domain directory with this rule
    
    RewriteEngine On
    RewriteBase / 
    RewriteCond %{HTTP_HOST} ^xyz.abcd.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.xyz.abcd.com$
    RewriteRule ^/?$ "http\:\/\/www\.xyz.\.com\/" [R=301,L]
    
    Code (markup):
     
    Mystique, Apr 14, 2010 IP
  5. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I think the best solution is to better design your document roots if possible. In cPanel when you add an add-on domain it suggests this:

    public_html/xyz.com

    This is just a suggestion for document root you could remove the public_html portion and just have xyz.com. In fact some of our customers get more creative they do things like this:

    sites/xyz.com
    sites/abc.com

    Or even do categories so something like this:

    sites/blogs/xyz.com
    sites/blogs/abc.com
    sites/forums/forumabc.com

    There is nothing stopping you from putting the document root of a site below the public_html folder. The public_html folder is the document root for the main domain. Anywhere you specify a document root for a domain makes it publically accessible for that domain.
     
    InFloW, Apr 14, 2010 IP
    Mystique likes this.