开发者

Blocking access to addon domains

开发者 https://www.devze.com 2023-02-05 01:38 出处:网络
I\'m using cpanel to create addon domains for my account, the addon domains are开发者_JAVA百科 created so that addon.com is put in the path /home/user/public_html/addon.com/ which means I can access t

I'm using cpanel to create addon domains for my account, the addon domains are开发者_JAVA百科 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


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.


use htaccess and look at hostname and redirect if it wrong

0

精彩评论

暂无评论...
验证码 换一张
取 消