richardk wrote:Try
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
# Match the query string variable.
RewriteCond %{QUERY_STRING} ^(.*&)?var=2(&.*)?$ [NC]
# Match the file and redirect to the new URL.
RewriteRule ^file\.php$ /somenew/url/? [NC,R=301,L]
Very nice, thank you.
I ran into another problem, var=x works redirecting to somenew/url/, but var=x&anothervar=y still redirects to somenew/url when Im using your code:
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
# Match the query string variable.
RewriteCond %{QUERY_STRING} ^(.*&)?var=x$anothervar=y(&.*)?$ [NC]
# Match the file and redirect to the new URL.
RewriteRule ^file\.php$ /different/url/? [NC,R=301,L]
Any way to tweak it?
Thank you very much again.