Reputation: 725
I'm trying to figure out how to write the correct regular expression when the url
has question marks inside.
The url:
http://example.com/?s2=1ce05156af2162c654b25a6e0491223269?lang=en
The rewrite I have made but not working
RewriteRule ^s2=[A-Za-z0-9.-]+\?lang=en\b /subscription-confirmation/?lang=en [L,R=301]
Important that it looks for ?s2= and ?lang=en
I use mod_rewrite
to do the redirect.
How do I match the regex
so it actually matches similar to the one above?
Upvotes: 0
Views: 223
Reputation: 725
This worked for me:
RewriteCond %{QUERY_STRING} ^s2=[A-Za-z0-9.-]+\?lang=en
RewriteRule .*$ /subscription-confirmation/?lang=en [L,R=301]
Upvotes: 1