Url rewrite help

hi
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;

how do i fix this?
thanks a lot!

On Saturday 08 December 2007, [email protected] wrote:

thanks a lot!
rewrite ^(/[^/]+.xml)$ /static$1;

On Sat, Dec 08, 2007 at 09:31:49AM -0800, [email protected] 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;

how do i fix this?

You do not need rewrite. Try to avoid a rewrite as much as possible.

 location ~ ^/[^/]+\.xml$ {
     root   /path/to/static;
 }

On Dec 8, 2007 9:45 AM, Igor S. [email protected] wrote:

}

this has to be in server section right? if i want this common for all
virtual hosts, how do i do it?

On Sat, 2007-12-08 at 10:01 -0800, [email protected] wrote:

    >   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

On Sat, Dec 08, 2007 at 10:01:36AM -0800, [email protected] wrote:

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?

The rewrites may be used inside server section only too.
And this was done intentionally: some day you will want to add site
where this global rewrite will interfere and you have to move
the rewrite to all sites except new one.

I had deal with many legacy Apache configuraitons with lot of global
s, , s, and RewriteRule’s.
It’s really hard to add new sites in such configuraitons.

Do scalable configuraiton from the very start.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs