.htaccess allow/deny ip using require apache 2.4

蹲街弑〆低调 提交于 2020-01-13 20:39:07

问题


My hosting provider recently updated the server to Apache 2.4 and the rules to control access to a specific folder via .htacces file doesn't work anymore with this code:

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

After reading Apache 2.4 documentation I understand i should use something like this instead:

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

but it doesn't work. Any one who can help me figuring this out? Thank you!


回答1:


For 2.4 it now looks something like this:

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

EDIT:

Require ip 123.123.123.123
Require ip 123.123.123.123

A document describing information critical to existing Apache HTTP Server users.

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



来源:https://stackoverflow.com/questions/37865658/htaccess-allow-deny-ip-using-require-apache-2-4

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!