Let's say I have a URL such as:
http://www.example.com/something.html?abc=one&def=two&unwanted=three
I would like to remove the URL parameter unwanted
and keep the rest of the URL in tact and it should look like:
http://www.example.com/something.html?abc=one&def=two
This specific parameter can be anywhere in the URL with respect to other parameters. The redirect should work regardless.
Can this be achieved?
I wanted to do something similar to this and here's the result ammended back to the context of the original question (regex is based on Milos Jovanovic's Answer)
this way we only set one variable and if the updated $args is empty we dont have an unwanted ? at the end of the url as the server handles that itself
You can achieve that this way