web.com
Thinking about selling online? Build your eCommerce site with Web.com.
Restrict subdomain access to addon domains
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 subdomain access to addon domains

Summary

Each Addon Domain requires a subdomain. Using mod_rewrite you can stop people from being able to use the addon domain as a subdomain of the primary domain

Preventing use of the Subdomain

Put this in the .htaccess file located at the subdomains folder, changing the subdomain, primarydomain.com and addondomain.com:

RewriteEngine On
            RewriteCond %{HTTP_HOST} ^subdomain.primarydomain.com$ [OR]
            RewriteCond %{HTTP_HOST} ^www.subdomain.primarydomain.com$ [OR]
            RewriteCond %{HTTP_HOST} ^addondomain.com$
            RewriteCond %{REQUEST_URI} ^/$
            RewriteRule ^(.*)$ http://www.addondomain.com/ [R=301,L]
Knowledgebase Article 363,169 views bookmark tags: addon domain htaccess


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

I do not want to see addon.maindomain.com. How do I do that?
Knowledgebase Article 285,040 views tags: accessible addon directory domain folders hidden htaccess inaccessible primary secondary

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

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

Related Help Content

How do I make a sub directory (or sub folder) act as the public_html for your main domain?
Knowledgebase Article 1,032,903 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 398,809 views tags: addon domain ftp

What is an Addon domain?
Knowledgebase Article 465,692 views tags: addon domain

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

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

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

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

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

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