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.