【问题标题】:htaccess allow,deny rules behaving strangelyhtaccess 允许,拒绝行为异常的规则
【发布时间】:2015-10-22 16:17:50
【问题描述】:

长话短说,我有一个我想要完全禁止访问我的网站的 IP 地址列表。当我像这样配置我的 htaccess 文件时......

order allow,deny
allow from all
deny from 123.456.789.012
deny from 123.456.789.013
[etc...]

...它不起作用。那些 IP 地址仍然能够打击我的网站。但是当我注释掉“全部允许”时......

order allow,deny
#allow from all
deny from 123.456.789.012
deny from 123.456.789.013
[etc...]

...然后它起作用了,因为我可以看到没有人能够访问我的网站,并且流量迅速下降到零。问题是,我只想阻止那些 IP 地址,而不是所有人。我在这里错过了什么?

【问题讨论】:

    标签: apache .htaccess spam-prevention


    【解决方案1】:

    改变顺序,让all from all在最后。

    order allow,deny
    deny from 123.456.789.012
    deny from 123.456.789.013
    allow from all
    

    【讨论】:

    • 完美,谢谢。不知道为什么我认为“所有人的允许”必须位于顶部,但您的解决方案成功了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-14
    • 2014-10-23
    • 2014-09-03
    • 2015-02-04
    • 1970-01-01
    • 2011-07-02
    相关资源
    最近更新 更多