9

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 Answer 1

11

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.
2
  • 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). Commented May 11, 2015 at 16:24
  • -e seems means everything that "include a file, directory, or symbolic link " which mentioned above
    – TOMARTISAN
    Commented Jan 30 at 4:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .