Restrict Access to Addon Domains through the Main Domain | Bluehost Support
Support
  1. bluehost knowledge base

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]

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.