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 116,115 views bookmark tags: accessible addon directory domain folders hidden htaccess inaccessible primary secondary (updated 977 days ago)


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? (updated 986 days ago)
Knowledgebase Article 154,153 views tags: addon domain htaccess

How do I make a sub directory (or sub folder) act as the public_html for your main domain? (updated 8 days ago)
Knowledgebase Article 529,375 views tags: Drupal domain htaccess joomla wordpress

How do I FTP to my addon domains without interfering with my main account. (updated 985 days ago)
Knowledgebase Article 186,346 views tags: addon domain ftp

Related Help Content

What is the difference between parked domains and addon domains? (updated 983 days ago)
Knowledgebase Article 117,187 views tags: add addon domain park parked

Can I have multiple domains pointing to my site or to a directory on my site? (updated 306 days ago)
Knowledgebase Article 202,247 views tags: domain domains

What is an Addon domain? (updated 237 days ago)
Knowledgebase Article 138,132 views tags: addon domain

How can I publish via FrontPage to an addon domain without using my main domain password? (updated 180 days ago)
Knowledgebase Article 77,486 views tags: addon frontpage password

How do I setup an addon domain or parked domain in my hosting account? (updated 202 days ago)
Knowledgebase Article 333,445 views tags: addon domains parked

Can I make subdomains for my addon domains on the account? (updated 984 days ago)
Knowledgebase Article 143,360 views tags: add addon dns domain park subdomain

I have setup a pointed/addon domain, where should I upload the files for this domain? (updated 986 days ago)
Knowledgebase Article 127,507 views tags: addon domain pointed

An expanded explanation of what the main mail sub folders are, such as cur, new and tmp. (updated 793 days ago)
Knowledgebase Article 16,922 views tags: directory email webmail