Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 禁用通过主域访问附加域_.htaccess_Subdomain_Cpanel_Addon Domain - Fatal编程技术网

.htaccess 禁用通过主域访问附加域

.htaccess 禁用通过主域访问附加域,.htaccess,subdomain,cpanel,addon-domain,.htaccess,Subdomain,Cpanel,Addon Domain,我的主网站上有10个附加域,你可以访问任何附加域(称为test1.com)网站,链接为test1.mainwebsite.com或www.mainwebsite.com/test1 如何阻止访问插件 我已经试过了,但是这个块只有www.mainwebsite.com/test1way RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?mainwebsite.com$ [NC] RewriteCond %{REQUEST_UR

我的主网站上有10个附加域,你可以访问任何附加域(称为test1.com)网站,链接为test1.mainwebsite.com或www.mainwebsite.com/test1

如何阻止访问插件

我已经试过了,但是这个块只有www.mainwebsite.com/test1way

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

禁用对子域的访问

下面是一个“.htaccess”代码示例,它提供了一种彻底的方法,通过强制执行“404未找到”错误,使附加域文件夹及其内容在主域中不可见。这将适用于web浏览器和搜索引擎:

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

可能您可以在条件RewriteCond%{HTTP_HOST}中添加类似的内容^www.mainwebsite.com(**)$