What does the RewriteCond directive mean?

What does this - RewriteCond mean in Apache?

And more specifically, this means, if it is not difficult, put it on the shelves, and then it is difficult for my brain to perceive this information.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

What does this mean? - If the directory or file requested in the URL exists, we access it directly.

Author: cheops, 2016-07-16

1 answers

These directives set the conditions for the next directive after them RewriteRule. That is, they do not apply by themselves, they should be followed by the directive they affect

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index.php [L]

In particular, !-f requires that the RewriteRule rule only applies if the request does not match a physically existing file, and !-d - the request should not apply if a physically existing folder is requested. Thus, the rule in RewriteRule following these directives will concern only virtual URLs for which there is no folder or file on the server disk.

 12
Author: cheops, 2016-07-16 12:48:56