Reputation: 11
Need help in writing a RewriteCond to check if a specific QueryString
does not exist in the URL.
If a specific string "?nvi
" does not exist then only should I redirect the URL.
Below Rule is what I have written but it does not work:-
RewriteCond %{QUERY_STRING} !(.*nvi.*) [NC]
RewriteRule . /index.php [L]
But the above rule fails even when the URL has string "?nvi
" in the URL(www.text.com?svi
).
Please help me write rewritecond which will redirect to a new URL only when the "?nvi
" string does not exist in the requested URL.
Upvotes: 1
Views: 5357
Reputation: 784928
Try this rule:
RewriteCond %{QUERY_STRING} !^nvi [NC]
RewriteRule ^ /index.php? [L]
?
in the end will strip down existing query string.
Upvotes: 3