Welcome! Log In Create A New Profile

Advanced

Re: rewrite url segment staging site and live site

B.R.
June 13, 2012 12:02PM
Try to use your regex in the location path too.

location '/old' only catches '/old', not even '/old/' and of course nothing
lie '/old/....'
Then, inside, you rewrite only URI which start with '/old/', so *in fine*,
nothing will be ever redirected.

The machine does precisely what you asked it to do.
---
*B. R.*


On Wed, Jun 13, 2012 at 10:31 AM, caleboconnell <nginx-forum@nginx.us>wrote:

> That's exactly what I thought, but when I used (.*) at the end and used
> the $1 I kept getting 404. When I made it the way it is now, it worked
> on my staging site as expected but not on my live site.
>
> I can confirm that on neither site, the following does not work (404
> error):
>
> location /old {
> rewrite ^/old/(.*)$ /new/$1 permanent;
> }
>
> the following will redirect anything from old to the landing page for
> the new section
>
> location /old {
> rewrite ^/old? /new permanent;
> }
>
>
> here is the current config, with prior rewrites before this location
> block:
>
> location / {
> index index.php;
> try_files $uri $uri/ @ee;
> }
>
> location @ee {
> rewrite ^(.*) /index.php?/$1 last;
> }
>
> location /old {
> rewrite ^/old? /new permanent;
> }
>
> I tired to use (.*) and $2 in hopes that the prior $1 wasn't breaking
> it. Still no luck.
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,227464,227496#msg-227496
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
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: 270
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