8

I'm in the process of migrating from Apache to nginx and have used http://winginx.com/en/htaccess to migrate the rewrite rules. I'm trying to understand what the translated ones mean though and I can't find any documentation on it. Here's an example:

if (-e $request_filename){
    rewrite ^(.*)$ /index.php break;
}

I believe -f checks if a file exists, and -d checks if a directory exists, but what about -e? And where might I find these in the documentation? Thank you!

1 Answers1

9

According docs:

  • checking of a file existence with the -f and !-f operators;
  • checking of a directory existence with the -d and !-d operators;
  • checking of a file, directory, or symbolic link existence with the -e and !-e operators;
  • checking for an executable file with the -x and !-x operators.
Federico Sierra
  • 3,499
  • 1
  • 18
  • 24
  • 2
    The docs don't say much beyond what you pasted, but these appear to be modeled after the UNIX/POSIX "test" utility (`man test`). – Gerald Combs May 11 '15 at 16:24