【问题标题】:.htaccess block all ip's, if they are blocked redirect to a page.htaccess 阻止所有 ip,如果它们被阻止重定向到页面
【发布时间】:2011-12-01 21:25:48
【问题描述】:

所以我屏蔽了除列表中的 IP 之外的所有 IP,那么如果人们被屏蔽,我如何将他们重定向到新站点?

【问题讨论】:

    标签: .htaccess ip block


    【解决方案1】:

    我的假设是您正在使用允许/拒绝阻止 ip。我不相信您能够指定重定向规则来处理被拒绝的 IP,因为您已经告诉服务器彻底拒绝他们的连接。

    相反,您将希望使用 RewriteEngine 进行重定向。如果您不熟悉语法,我提供了以下示例,该示例会将除“72.14.204.99”和“72.14.204.100”之外的所有 IP 重定向到“example.org”:

    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !^72\.14\.204\.99$
    RewriteCond %{REMOTE_ADDR} !^72\.14\.204\.100$
    RewriteRule ^ http://www.example.org/ [R]
    

    【讨论】:

      猜你喜欢
      • 2012-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-23
      • 1970-01-01
      • 2015-10-05
      • 1970-01-01
      相关资源
      最近更新 更多