I had the same problem, but even harder because I needed to drop other options.
Example: my-old-page.php?a=1&b=2&c=3
I need to use one of the lines and discard the rest, but this solution only works if I want to use the last parameter (c = 3). If I want to use any other (a = 1 or b = 2), it will work until 404. After long battles and searching, I found the answer:
RewriteCond %{QUERY_STRING} ^.* ?b=2.* ?$ (without space after the *) RewriteRule (.*) http://www.my-webpage.php/new-location-2? [R=301,L]
The solution is to add ".*?"
before and after using the parameter.
I don't know if this is the best solution, but it works.
source share