I'm using cpanel to create addon domains for my account, the addon domains are created so that addon.com
is put in the path /home/user/public_html/addon.com/
which means I can access them via primarydomain.com/addon.com
. I'd like to cut off access to these directories so people can't access them outside of their domain
Asked
Active
Viewed 176 times
0

Ben
- 60,438
- 111
- 314
- 488
2 Answers
1
Add the following code in your .htaccess file at the root of addon.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.primarydomain\.com$
RewriteRule ^(.*)$ path/to/404/ErrorDoc
Alternative and far better: while creating addon.com specify the document root as outside the public_html folder. ie. /addon.com instead of /public_html/addon.com.
Hope that helps.

Tabrez Ahmed
- 2,830
- 6
- 31
- 48