我有一个文件结构,看起来像这样:
/public_html
.htaccess
index.php
/country
index.php
/item
index.php
在**.htaccess**中:
<RequireAll>
Require all denied
Require ip 123.456.789.123
</RequireAll>
假设我的IP是123.456.789.123
但其他用户仍然可以访问index.phpat www.example.com/country/
以前我需要做的就是更改一个ip行,但现在我必须创建.htaccess并将上面的RequireAll命令添加到每个文件夹,如下所示:
/public_html
.htaccess
index.php
/country
.htaccess #extra 1
index.php
/item
.htaccess #extra 2
index.php
想要减少创建的两个额外的.htaccess
此外,所有三个.htaccess都是644权限。
1条答案
按热度按时间jrcvhitl1#
**1.**位于/public_html/.htaccess:
**2.**并删除位于/public_html/country和/public_html/item的.htaccess
**3.**如果是多个国家,即:
然后可以用途: