0

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

Ben
  • 60,438
  • 111
  • 314
  • 488

2 Answers2

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
-1

use htaccess and look at hostname and redirect if it wrong

Carter Cole
  • 918
  • 9
  • 16