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 164,377 views bookmark tags: addon domain htaccess (updated 1136 days ago)


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? (updated 1128 days ago)

Creating Sub Domains on an Add-on Domain

Can I make subdomains for my addon domains on the account? (updated 1134 days ago)

How to host the 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? (updated 159 days ago)

Related Help Content

What is an Addon domain?

What is an Addon domain? (updated 388 days ago)

FTP for addon domains

How do I FTP to my addon domains without interfering with my main account. (updated 1136 days ago)

Parked Domains vs. Addon Domains

What is the difference between parked domains and addon domains? (updated 1135 days ago)

Assigning an Addon or Parked domain

How do I setup an addon domain or parked domain in my hosting account? (updated 353 days ago)

How to fix ExecGCI in .htaccess

How to run CGI scripts for Addon domains. (updated 1135 days ago)

Where to Upload Files for an Addon Domain

I have setup a pointed/addon domain, where should I upload the files for this domain? (updated 1137 days ago)

Email Account Setup for Addon/Parked Domains

Can I setup an email account for Addon or Parked domains? (updated 1137 days ago)

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? (updated 54 days ago)