I want to use rewrite rule to redirect this specific URL:
https://example.net/?myvar=none
to:
https://example.net/test-page-to-redirect/
It's very important only redirect this specific url, because for example, this url is correct
https://example.net/?myvar=111
I'd tried several options without results, lastest i try:
RewriteCond %{QUERY_STRING} myvar=none
RewriteRule .* /test-page-to-redirect [R=302]
Thanks you for your help
CodePudding user response:
You may use this redirect rule:
RewriteCond %{QUERY_STRING} ^myvar=none$
RewriteRule ^$ /test-page-to-redirect/? [R=302,L]
Make sure to clear your browser cache before testing this change.
By using anchors in RewriteCond
and in RewriteRule
we are making sure that only given URL matches nothing else.