Restrict Access to Addon Domains through the Main Domain
If you are using assistive technology and are unable to read any part of the HostMonster website, or otherwise have difficulties using the HostMonster website, please call 866-573-HOST and our customer service team will assist you.
Skip to main content

HostMonster Web Hosting Help

Restrict Access to Addon Domains through the Main Domain

Summary

All Addon Domains must be associated with a subdomain. You are able to disable access to the subdomain, this article will show you how to do this.

Disable access to a subdomain

The following is an example '.htaccess' code which provides a thorough means of making the Addon domain folders, and their contents, invisible through the main domain by forcing a "404 Not Found" error. This will work both for web browsers and search engines:

    RewriteEngine On
                RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
                RewriteCond %{REQUEST_URI} ^/addonfolder/(.*)$
                RewriteRule ^(.*)$ - [L,R=404]
The example rewrite rules will force 'http://www.domain.com/addonfolder/' and any of its contents to report the "404 Not Found" error.

Be sure to replace the 'domain.com' in the example with your hosting account's main domain address and 'addonfolder' with the name of the folder for your Addon domain.

This can also be applied to multiple Addon domain folders through the use of the [OR] option as in the following example in which 3 Addon folders are being reported as "404 Not Found" when accessed through the main domain:

    RewriteEngine On
                RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
                RewriteCond %{REQUEST_URI} ^/addon1/(.*)$ [OR]
                RewriteCond %{REQUEST_URI} ^/addon2/(.*)$ [OR]
                RewriteCond %{REQUEST_URI} ^/addon3/(.*)$
                RewriteRule ^(.*)$ - [L,R=404]

Knowledgebase Article 338,239 views bookmark tags: accessible addon directory domain folders hidden htaccess inaccessible primary secondary


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

How do I stop people from being able to use the addon domain as a subdomain of the primary domain?
Knowledgebase Article 421,794 views tags: addon domain htaccess

How do I make a sub directory (or sub folder) act as the public_html for your main domain?
Knowledgebase Article 1,099,057 views tags: Drupal domain htaccess joomla wordpress

How do I FTP to my addon domains and subdomains without interfering with my main account.
Knowledgebase Article 459,470 views tags: addon domain ftp

Related Help Content

What is the difference between parked domains and addon domains?
Knowledgebase Article 450,603 views tags: add addon domain park parked

What is an Addon domain?
Knowledgebase Article 534,146 views tags: addon domain

Can I have multiple domains pointing to my site or to a directory on my site?
Knowledgebase Article 519,014 views tags: domain domains

How can I change the primary domain name on my account?
Knowledgebase Article 1,414,635 views tags: account change domain primary rename

How do I setup an addon domain or parked domain in my hosting account?
Knowledgebase Article 916,501 views tags: addon domains parked

I have setup a pointed/addon domain, where should I upload the files for this domain?
Knowledgebase Article 331,457 views tags: addon domain pointed

How to run CGI scripts for Addon domains.
Knowledgebase Article 234,121 views tags: cgi htaccess

Can I make subdomains for my addon domains on the account?
Knowledgebase Article 523,721 views tags: add addon dns domain park subdomain

This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here