rewrite rule help...

Igor Sysoev is at rambler-co.ru
Wed Aug 5 12:06:41 MSD 2009


On Wed, Aug 05, 2009 at 02:34:50AM -0400, Ilan Berkner wrote:

> What would be the nginx comparable?
> 
> 
>    1. RewriteEngine On
>    2. RewriteBase /
>    3. RewriteRule js/site_([0-9]+).js js/combine.php?version=$1 [L]
> 
> ?

A usual way:

location /js/ {
    rewrite  ^/js/site_([0-9]+).js /js/combine.php?version=$1  last;
    ...
}

location ~ \.php$ {
    ...
}

The true nginx way:

location ~ ^/js/site_([0-9]+).js {
    ...
    fastcgi_pass   SCRIPT_FILENAME  /path/to/js/combine.php;
    fastcgi_pass   QUERY_STRING     version=$1;
    ...
}


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list