file tests in subfolder and rewriting

Boris Bartsyts bartzitz at gmail.com
Tue Mar 13 19:03:45 MSK 2007


neither of this works too. i've managed to do it this way:

    if (-f $request_filename) {
        break;
    }

    if ($request_filename !~ /cache.*) {
        rewrite ^(.*)\.html  /cache$1.html;
    }

    if (!-f $request_filename) {
	php rewrite rules here...
    }

but it would be nice to know if the original approach is possible
somehow.

Boris


On Tue, 2007-03-13 at 16:43 +0100, Roxis wrote:
> 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