file tests in subfolder and rewriting

Roxis roxis at list.ru
Tue Mar 13 18:43:05 MSK 2007


On Tuesday 13 March 2007, Boris Bartsyts wrote:
>     if (-f /cache$request_filename) {
>         rewrite ^(.*)$ /cache$1 break;
>     }
>
> and with a variable:
>
>     set $file /cache$request_filename;
>
>     if (-f $file) {
>         rewrite ^(.*)$ /cache$1 break;
>     }

try

if (-f $document_root/cache$request_filename) {
    rewrite ^(.*)$ /cache$1 break;
}

or

if (-f cache$request_filename) {
    rewrite ^(.*)$ /cache$1 break;
}





More information about the nginx mailing list