Welcome! Log In Create A New Profile

Advanced

Re: rewrite url segment staging site and live site

Francis Daly
June 14, 2012 05:18PM
On Wed, Jun 13, 2012 at 10:31:02AM -0400, caleboconnell wrote:

Hi there,

you have a working set up now, so all is good.

But still, I am very surprised that

> location /old {
> rewrite ^/old/(.*)$ /new/$1 permanent;
> }

will not cause a redirection for any request that starts /old/, when
replacing that location with

> location /old {
> rewrite ^/old? /new permanent;
> }

will lead to the expected redirection.

The solution you found was to change the location definition to avoid
trying any regex locations. That suggests that you had other regex
locations which were being matched instead of the ones above. But
independent of that, the above two locations should redirect almost all
of the same requests (all bar exactly "/old") -- so if the rest of the
configuration didn't change in between the two tests, you have found
something odd.

> here is the current config, with prior rewrites before this location
> block:

For information: because one request is handled by one location, the
order of location blocks within the config file is not relevant (apart
from regex ones).

Which just means that "the most recent match" may not be from the location
block a few lines earlier in the config file.

All the best,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

rewrite url segment staging site and live site

caleboconnell June 12, 2012 10:47AM

Re: rewrite url segment staging site and live site

Francis Daly June 12, 2012 01:24PM

Re: rewrite url segment staging site and live site

caleboconnell June 13, 2012 10:31AM

Re: rewrite url segment staging site and live site

B.R. June 13, 2012 12:02PM

Re: rewrite url segment staging site and live site

Francis Daly June 14, 2012 05:18PM

Re: rewrite url segment staging site and live site

caleboconnell June 13, 2012 12:31PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 302
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready