nginx rewrite for an url with parameters

Posted by David on Server Fault See other posts from Server Fault or by David
Published on 2010-07-15T15:50:01Z Indexed on 2010/12/27 18:55 UTC
Read the original article Hit count: 165

Filed under:
|

I have an URL of this type:

http://www.example.com/?param1=val1&param2=&param3=val3&param4=val4&param5=val5

And I want to redirect it to this one:

http://www.example.com/newparam/val3/val4

So I have tried this rewrite rule with no success:

rewrite "/?param1=val1&param2=&param3=(.+)&param4=(.+)&param5=(.+)" http://www.example.com/newparam/$1/$2 redirect;

Is nginx not able to deal with query parameters?

EDIT: I don't want to rewrite all petitions. I only need to rewrite that URL, without affecting the others.

© Server Fault or respective owner

Related posts about nginx

Related posts about redirect