rewrite url segment staging site and live site

caleboconnell nginx-forum at
Tue Jun 12 14:47:10 UTC 2012

I have a staging site that I test anything relating to the website
before we deploy.  I have an nginx config that I also test with for this
staging site.

I wanted to rewrite a uri segment where a section of the site changed

I added the following rewrite, which works perfectly on the staging

  location /old {
    rewrite ^/old/? /new/$1 permanent;

when I added this to the live nginx config, the rewrite works, but only
sort of:

what I want:  -->

what I get: --> 

It's fine for now, but I don't know why the exact config would work

The live nginx config is different than the staging, but only in that it
includes SSL info.  This may be the problem, but I'm not sure why.

Thank you in advance for any suggestions and/or answers.

Posted at Nginx Forum:,227464,227464#msg-227464

More information about the nginx mailing list