Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I rewrite URIs of the form

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

to

/one/two/three?foo=bar

using nginx?

share|improve this question

1 Answer 1

up vote 3 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;
    }
}
share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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