user7424312
user7424312

Reputation: 137

Rewrite Rule not works in htaccess

I have a problem with this redirect

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

No logs but the redirect is not made. Btw this redirect works fine :

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

Can you help me please ? Thx in advance and sorry for my english.

Upvotes: 0

Views: 46

Answers (1)

anubhava
anubhava

Reputation: 786291

RewriteRule cannot match a query string. You need to use a RewriteCond with %{QUERY_STRING} variable:

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

Upvotes: 1

Related Questions