【问题标题】:Rewritecond does not check for second conditionRewritecond 不检查第二个条件
【发布时间】:2014-04-26 20:19:25
【问题描述】:

我使用以下 rewritecond,但是当我使用 10.40.62.13 的浏览器访问服务器时,它仍然使用标准主页。

RewriteEngine On
RewriteCond %{http:iv-remote-address} ^((172\.30|10\.89)\.(.*)\.(.*))|((10)\.(40)\.(62)\.(13))$
RewriteRule ^(.*)$ /applications.html [PT,L]

【问题讨论】:

    标签: mod-rewrite redirect httpd.conf


    【解决方案1】:
    RewriteCond %{REMOTE_HOST} !^10\.40\.62\.13
    RewriteCond %{REMOTE_ADDR} !^172\.30\.10\.89
    RewriteCond %{REQUEST_URI} !/redirect_page\.html$
    RewriteRule \.html$ /redirect_page.html [R=302,L]
    

    【讨论】:

    • 谢谢你的答案,但你能解释一下它如何重定向一个像 172.30.10.20 或 10.89.10.20 这样的地址,因为我没有看到这个范围的检查吗?
    • 它只会在您从 10.40.62.13 访问服务器时重定向,对于多个 ip 我们需要解决方法.. 更新答案
    猜你喜欢
    • 2021-06-30
    • 2020-06-26
    • 2015-01-04
    • 1970-01-01
    • 2013-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-18
    相关资源
    最近更新 更多