【问题标题】:Rewrite Rule not works in htaccess重写规则在 htaccess 中不起作用
【发布时间】:2017-07-24 22:59:00
【问题描述】:

我有这个重定向的问题

RewriteRule ^games?game=MyGame$ /?noparams [R=301,L,QSA]

没有日志,但没有进行重定向。顺便说一句,这个重定向工作正常:

RewriteCond %{REQUEST_URI} ^/gift$
RewriteRule (.*) /?noparams [R=301,L]

你能帮帮我吗?提前谢谢,对不起我的英语。

【问题讨论】:

标签: php apache .htaccess


【解决方案1】:

RewriteRule 无法匹配查询字符串。您需要使用 RewriteCond%{QUERY_STRING} 变量:

RewriteCond %{QUERY_STRING} ^game=MyGame$ [NC]
RewriteRule ^games/?$ /?noparams [R=301,L,QSA,NC]

【讨论】:

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