internally redirected requests

Ruslan Ermilov ru at nginx.com
Wed Nov 21 15:13:24 UTC 2012


On Wed, Nov 21, 2012 at 06:12:40AM -0500, nri.pl wrote:
> How to do internal redirect (which is the best way)? I do not want to apply
> to this "include".
> Maybe I can do something like this:
> 
> location /a { alias @app; }
> location /b { alias @app; }
> 
> location @app { ... }
> 
> Should I use to this "error_page" or "try_files" if I do not dealing with
> static files ?

location /a {
    return 418;
    error_page 418 = @teapot;
}

location /b {
    return 418;
    error_page 418 = @teapot;
}

location @teapot {
    return 200 "uri=$uri\nargs=$args\n";
}

See:

http://nginx.org/r/internal
http://nginx.org/r/error_page



More information about the nginx mailing list