Regex and mod_rewrite

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=enb /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?


Source: regex

Leave a Reply