anewg
V2EX  ›  问与答

Apache Rewrite 循环重定向了,怎么解决?

  •  
  •   anewg · Nov 27, 2013 · 5264 views
    This topic created in 4553 days ago, the information mentioned may be changed or developed.
    Hosts设置 w11.gongzhonghao.cn 到 127.0.0.1

    Windows的XAMPP,Apache版本 2.4


    RewriteEngine On

    RewriteCond %{QUERY_STRING} (.*)mod=wsplist(.*) [NC] #该Cond为何未生效?
    RewriteRule . - [L]

    RewriteCond %{HTTP_HOST} ^w(\d+).gongzhonghao.cn$ [NC]
    RewriteRule . http://w%1.gongzhonghao.cn/wz.php?mod=wsplist&wspid=%1 [L]


    结果就是(访问根目录w11.gongzhonghao.cn后抓包):
    /
    http://w11.gongzhonghao.cn/wz.php?mod=wsplist&a=h&wspid=11
    http://w11.gongzhonghao.cn/wz.php?mod=wsplist&a=h&wspid=11
    ....
    ....

    为什么QUERY_STRING没有匹配成功?匹配成功的话
    RewriteRule . - [L]
    这句应该会阻止循环重定向才对的吧?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2985 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 321ms · UTC 09:32 · PVG 17:32 · LAX 02:32 · JFK 05:32
    ♥ Do have faith in what you're doing.