Welcome! Log In Create A New Profile

Advanced

Alternative to try_files

Posted by stalkerX 
Alternative to try_files
October 14, 2012 03:43AM
Hi,

I'm looking for an alternative to try_files.
I want to check for the existence of a file and then run a redirect to other file. So according to this pattern:

if ( file_exists($my_file_on_hdd) ) {
rewrite $other_file_on_hdd;
}

Any ideas?

Thanks.
Re: Alternative to try_files
October 20, 2012 12:54PM
Make a location block pointing to a file, and put your rewrite inside of there. It won't check if the file exists, but if you want it to redirect anyways, that shouldn't matter.

location /some_file {
rewrite another_file;
}

--
Piki
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 262
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready