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