I’ve benn trying to figure out what these two lines in Mod_Rewrite do and would appreciate some help. Thanks in advance.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They check if the requested URI is an existing file or a directory. The
!in front makes the condition “not”, thus,, the request does NOT map to a file or directory.See the
-fand-ddescription in mod_rewriteNo. The request could be for something that doesn’t exist and be rewritten. For example, http://en.wikipedia.org/wiki/something would mean the URI is
/wiki/something, which doesn’t map to any physical file or directory. But internally, there is a rule that rewrites/wiki/somethingtoindex.php?title=something, andindex.phpdoes exist.Edit: for edited question
.phpto the end.!-fand!-dchecks: