1

到目前为止我一直在使用

RewriteCond %{QUERY_STRING} =""

或者

RewriteCond %{QUERY_STRING} !.*=.*

在应用重写规则之前,要检查的条件是我的查询字符串为空。从 Apache 2.4 开始,这些指令不再起作用。

例如,对于我的http://test.loc/地址 mod_rewrite 日志输出如下:

RewriteCond: input='ver=1.0' pattern='=""' => not-matched, referer: http://test.loc/

或使用第二个指令时

RewriteCond: input='ver=1.0' pattern='!.*=.*' => not-matched, referer: http://test.loc/

任何帮助表示赞赏。

4

1 回答 1

1

用正则表达式试试这个:

RewriteCond %{QUERY_STRING} ^(input=[^&]*)?$
于 2013-10-29T20:09:04.583 回答