Home .htaccess What does the RewriteCond directive mean?

What does the RewriteCond directive mean?




What does this mean – RewriteCond in Apache?

And more specifically, it means, if not difficult, sort it out on the shelves, otherwise it is difficult for my brain to perceive this information.

RewriteCond% {REQUEST_FILENAME}! -f

What does this mean? – If the directory or file requested in the URL exists, refer to them directly from the documentation

Answer 1, authority 100%

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

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

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

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions