Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I rewrite URIs of the form




using nginx?

share|improve this question
up vote 4 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


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.