Rewrite Rules

Paul Greenwood attaboy.p at gmail.com
Tue Feb 17 21:55:51 MSK 2009


Thank You

On Tue, Feb 17, 2009 at 9:22 AM, Igor Sysoev <is at rambler-co.ru> wrote:

> On Tue, Feb 17, 2009 at 07:48:30AM -0700, Paul Greenwood wrote:
>
> > Are the rewrite rules processed in the order they are listed in the
> > nginx.conf file or does nginx put them in the correct order when nginx is
> > started up?
>
> nginx processes if/set/rewrite in following order:
>
> 1) server level rules;
> 2) then locaiton level rules;
>   if a matching rewrite rule has no break flag,
>   then nginx searches a new location and go to (2),
>   i.e. runs location level rules.
>
> On given level rules are processed in the order they are listed.
>
> Example for request "/":
>
>       server {
>
>           rule1
>
>           location / {
>               rule3
>               rule4
>           }
>
>           location ~ \.php$ {
>               rule5
>           }
>
>           rule2
>
> rule1, rule2,
> rule3, rule4; rule4 rewrites to index.php;
> rule5
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090217/6dd2f110/attachment.html>


More information about the nginx mailing list