【问题标题】:Rewrite condition in .htaccess not working.htaccess 中的重写条件不起作用
【发布时间】:2011-11-02 11:36:12
【问题描述】:

我一直试图让重写条件起作用,但它只是没有它(它根本没有重定向,所以我相信它不符合条件)。这是我尝试重定向的动态 URL 的示例:

http://mysite.com/cgi-bin/sh000001.pl?REFPAGE=FT10

到:

http://mysite.com/siteref/FT10/

这是脚本:

RewriteBase /
RewriteCond %{QUERY_STRING} ^REFPAGE=(.*)$
RewriteRule ^cgi-bin/sh000001.pl$ siteref/%1/ [L,R=301]

(我确实打开了 RewriteEngine)

谢谢

【问题讨论】:

    标签: .htaccess url url-rewriting pattern-matching conditional-statements


    【解决方案1】:

    我认为 RewriteCond 正在工作,但问题可能是您已获得 /cgi-bin/ scriptaliased 并且 mod_alias 可能在请求到达 mod_rewrite 之前解决了该请求。您可以尝试删除 /cgi-bin/ 的 ScriptAlias

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-15
      • 2017-08-10
      相关资源
      最近更新 更多