+91 - 9161069102 support@megaacshost.com

How to restrict access of Addon Domain through Main Domain so that the contents are not visible from folder view?

How to restrict access of Addon Domain through Main Domain so that the contents are not visible from folder view?

Most of MEGA ACS HOST’s Client asked how to hide the Main domain from the URL if anyone wants to access their Addon Domains.

To be more clear let me take an example to brief you, suppose you create any addon domain then the actual path of your addon domain
will be maindomain.com/addon_domain.com because addon_domain.com
is literally a directory in your main domain. So now if you want
to hide the main domain from the URL you have to use htaccess rule
to deny urls starting with /addon_domain.com.

The following htaccess’ code which when applied in htaccess file inside
Addon Directory will generate 404 Error “Page Not Found” if someone wants
to access Addon domain through Main domain in the URL tab.

RewriteEngine On
                RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
                RewriteCond %{REQUEST_URI} ^/addonfolder/(.*)$
                RewriteRule ^(.*)$ - [L,R=404]

Just make sure to replace the ‘yourdomain.com’ in the example with your hosting
account’s main domain and ‘addonfolder’ with the name of the folder
for your Addon domain.

Hope this article helped you… for more queries and suggestions feel free
to write or you can also comment below…

For more information on issues related to your website contact MEGA ACS HOST.

Leave a Reply

Your email address will not be published. Required fields are marked *