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 153,821 views bookmark tags: addon domain htaccess (updated 982 days ago)


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? (updated 973 days ago)
Knowledgebase Article 115,848 views tags: accessible addon directory domain folders hidden htaccess inaccessible primary secondary

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

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

Related Help Content

What is an Addon domain? (updated 233 days ago)
Knowledgebase Article 137,819 views tags: addon domain

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

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

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

How to run CGI scripts for Addon domains. (updated 980 days ago)
Knowledgebase Article 82,737 views tags: cgi htaccess

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

Can I setup an email account for Addon or Parked domains? (updated 982 days ago)
Knowledgebase Article 115,379 views tags: addon domain email pointed

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