Bluehost 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 420,543 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

Restrict Access to Addon Domains through the Main Domain

I do not want to see addon.maindomain.com. How do I do that?

What Is A Subdomain And How Does It Work? How To Create A Subdomain

Can I make subdomains for my addon domains on the account?

What Is The Difference Between Addon Domain, Parked Domain & Subdomain?

What is the difference between parked domains and addon domains?

Related Help Content

How To Host Primary Domain From A Subfolder htaccess

How do I make a sub directory (or sub folder) act as the public_html for your main domain?

FTP for Addon Domains and Subdomains

How do I FTP to my addon domains and subdomains without interfering with my main account.

What Is An Addon Domain And How Does It Work?

What is an Addon domain?

How To Assign A Domain Name - A Record, Name Servers, HTML Page

How do I setup an addon domain or parked domain in my hosting account?

How To Change Your Primary Domain

How can I change the primary domain name on my account?

How to fix ExecCGI in .htaccess

How to run CGI scripts for Addon domains.

Where to Upload Files for an Addon Domain

I have setup a pointed/addon domain, where should I upload the files for this domain?

How to Setup Multiple Domains Pointing to the Same Directory

Can I have multiple domains pointing to my site or to a directory on my site?