.htaccess使用require apache 2.4允许/拒绝ip

时间:2016-06-16 17:21:41

标签: .htaccess

我的托管服务提供商最近将服务器更新为Apache 2.4,并且通过.htacces文件控制对特定文件夹的访问的规则不再适用于此代码:

Order Deny,Allow
 Deny from All
 Allow from 123.123.123.123
 Allow from 123.123.123.123
 Allow from 123.123.123.123

阅读完Apache 2.4文档后,我明白我应该使用类似的东西:

<RequireAny>
Require ip 123.123.123.123
Require ip 123.123.123.123
Require ip 123.123.123.123
</RequireAny>

但它不起作用。有谁可以帮我解决这个问题?谢谢!

1 个答案:

答案 0 :(得分:4)

对于2.4,它现在看起来像这样:

<RequireAll>
Require all denied
Require ip 123.123.123.123
Require ip 123.123.123.123
Require ip 123.123.123.123
</RequireAll>

编辑:

Require ip 123.123.123.123
Require ip 123.123.123.123

描述对现有Apache HTTP Server用户至关重要的信息的文档。

https://httpd.apache.org/docs/trunk/upgrading.html