Restrict subdomain access to addon domains

Problem:

How do I stop people from being able to use the addon domain as a subdomain of the primary domain?

Solution:

Put this in the .htaccess file located at the subdomains folder
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]
  • 41 Users Found This Useful
Was this answer helpful?

Related Articles

URL redirect/rewrite using the .htaccess file

Problem: How do I perform a URL redirect/rewrite using the .htaccess file? Solution: .htaccess...

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? The...

Redirects that do not work due to PHP variables

Problem: The redirection of www.yourdomain.com/default.html or index.html to...

Redirect

Problem: How do I create a redirect? Solution: The Redirects tool will allow you to redirect...

How to fix ExecGCI in .htaccess

How to run CGI scripts for Addon domains. Open the .htaccess file located in the...