Hi guys!!
I'v been working on the last few days, trying to change just one value of a parameter for a given domain.
Ej: Whenever a request like this is made:
http://testsite.com/?toChange=foo¬ToChange=bar1¬ToChange=bar2
i'll need to change the "toChange" parameter to ej: bar0, so after the redirect, i need to get something like this:
http://testsite.com/?toChange=bar0¬ToChange=bar1¬ToChange=bar2
I almost get it done with this:
{+redirect{s@^http://testsite.com/\?toChange=[^&](.)@http://testsite.com/?toChange=bar0$1@}}
testsite.com
But the problem with this last statement, is that erases everything behind the first parameter, so i end with something like this:
http://testsite.com/?toChange=bar0
instead of:
http://testsite.com/?toChange=bar0¬ToChange=bar1¬ToChange=bar2
Can you give me a clue about what i’m doing wrong?
Thanks!!
One problem is that the URL pattern will match the redirected URL, so the client will get redirected again (and again and again ...).
Another problem is that "^&" matches two characters of which the first one can't be an ampersand (&). This is probably not what you meant.
You could try something like:
{+redirect{s@toChange=[^&]+@toChange=bar0@}}
example.com/.*toChange=(?!bar0)
Works like a charm!
Thanks so much! Fabian!!
You're welcome. Thanks for the confirmation.