rewrite url segment staging site and live site

caleboconnell nginx-forum at nginx.us
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
names.

example.com/old/page1
                    /old/page2

example.com/new/page1
                    /new/page2

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

  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:
example.com/old/page1  -->  example.com/new/page1

what I get:
example.com/old/page1 -->  example.com/new 

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

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: http://forum.nginx.org/read.php?2,227464,227464#msg-227464



More information about the nginx mailing list