url rewrite help

Cliff Wells cliff at develix.com
Sun Dec 9 03:35:58 MSK 2007


On Sat, 2007-12-08 at 10:01 -0800, rkmr.em at gmail.com wrote:
> 
> On Dec 8, 2007 9:45 AM, Igor Sysoev <is at rambler-co.ru> wrote:
>         
>         On Sat, Dec 08, 2007 at 09:31:49AM -0800, rkmr.em at gmail.com
>         wrote:
>         > i am moving from lighttpd to nginx, and I had this rewrite
>         in lighttd. how 
>         > do i do this in nginx?
>         >    "^/[^/]+\.xml$" => "/static$0",
>         > i tried and dint work
>         >   rewrite    ^/[^/]+\.xml$  /static$1;
>         
>         You do not need rewrite. Try to avoid a rewrite as much as
>         possible. 
>             location ~ ^/[^/]+\.xml$ {
>                 root   /path/to/static;
>             }
> 
> this has to be in server section right? if i want this common for all
> virtual hosts, how do i do it?

Put the directives in a separate file and use the include directive in
each vhost.

Cliff
> 






More information about the nginx mailing list