How do I rewrite URIs of the form

/one/two?path=three&foo=bar

to

/one/two/three?foo=bar

using nginx?

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

Try this:

location ~ /one/two {
    if ($args ~ "path=([^&]+)&(.+)") {
        set $path $1;
        set $foo $2;
        rewrite ^/one/two "/one/two/$path?$foo?" permanent;
    }
}
link|improve this answer
Edit your first post and append the entire content of nginx.conf. – quanta Oct 14 '11 at 0:33
Where did you put HTTP basic authentication section? – quanta Oct 18 '11 at 2:42
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.