Currently, I’m using Redirection plugin in WordPress to redirect all URLs that contain question mark in this way:
Source: /(.*)?(.*)$ Target: /$1
This works well. It will redirect any link with a
?, such as
However, now I need to make an exception. I need to allow
/friends to pass GET parameters, e.g.
/friends/?more_params, without the parameters being truncated.
I have tried modifying the regular expression in the plugin to:
Source: /(?!friends/?)?(.*)$ Target: /$1
But this didn’t work. With the above expression, any link with
? is no longer redirected.
Can you help? Thank you in advance.
PS: Sorry if this is a duplicate question. I’ve searched this website for similar questions but based on what I’ve read, I still can’t piece together the right solution.