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

Alb*_*tro 3 .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
Run Code Online (Sandbox Code Playgroud)

阅读 Apache 2.4 文档后,我明白我应该使用这样的东西:

<RequireAny>
Require ip 123.123.123.123
Require ip 123.123.123.123
Require ip 123.123.123.123
</RequireAny>
Run Code Online (Sandbox Code Playgroud)

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

Joe*_*Joe 5

对于 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>
Run Code Online (Sandbox Code Playgroud)

编辑:

Require ip 123.123.123.123
Require ip 123.123.123.123
Run Code Online (Sandbox Code Playgroud)

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

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