Home > Domains > Make add-on domain NOT reachable via domain.com/addondomain.com

Make add-on domain NOT reachable via domain.com/addondomain.com

By default all add-on domains have folders generated inside the public_html folder (the hosting folder for the main domain on the account), thus all add-on domains are accessible from the main domain. If you wish to make the add-on domains NOT accessible via the root domain name, please add a redirect via the cPanel -> Redirects.

For example: Main domain name is domain.com, the add-on domain is addondomain.com. You can currently access it via domain.com/addondomain.com .

 A redirect should be placed on domain.com/addondomain.com to redirect back to domain.com. Also, you can solve this by creating a .htaccess file in public_html folder, with such content:

RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+)/.*\ HTTP [NC]
RewriteRule .* - [F,L]


This will prevent direct access to subfolders from the main domain name.