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

标签 .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>

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

最佳答案

对于 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

关于.htaccess 允许/拒绝 ip 使用 require apache 2.4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37865658/

相关文章:

.htaccess - 为特定图像添加过期标题

file - 拒绝访问特定目录中的特定文件类型

php - 使用虚拟主机时如何设置apache的环境变量?

php - htaccess -FallbackResource 奇怪的行为

regex - 将查询字符串重写为另一个查询字符串

apache - .htaccess 重写测试失败

WordPress 永久链接因虚拟主机而失败

apache - 使用 .htaccess 附加参数

apache - Htaccess 维护模式允许某些目录

php - Apache 重写规则强制下载