Nginx Rewrite Convert Querystring to Path

Posted by YardenST on Server Fault See other posts from Server Fault or by YardenST
Published on 2013-03-16T14:37:59Z Indexed on 2013/11/07 9:58 UTC
Read the original article Hit count: 264

Filed under:
|
|

I whould like this simple rewrite rule:

/somefolder/mypage.aspx?myid=4343&tab=overview

to be redirected to:

/folder/4343/overview/

I looked for some solutions and none actually worked..

I tried:

rewrite ^/somefolder/mypage.aspx?myid=(.*)&tab=overview$  /folder/$1/overview  permanent;

and

rewrite ^/somefolder/mypage\.aspx\?myid=(.*)&tab=overview$  /folder/$1/overview  permanent;

What am I doing wrong? I'm getting 404

(simpler rules works just fine..)

Thanks

© Server Fault or respective owner

Related posts about nginx

Related posts about rewrite