Just Host 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]
![](http://tutorials.Justhost.com/help_media/views.png)
![](http://tutorials.Justhost.com/help_media/star.png)
![](http://tutorials.Justhost.com/help_media/share.png)
![](http://tutorials.Justhost.com/help_media/tags.png)
Recommended Help Content
![](http://tutorials.Justhost.com/help_media/views.png)
![](http://tutorials.Justhost.com/help_media/tags.png)