The %{REQUEST_FILENAME}
contains a string like this:
/web/webroot/index.php
I see a lot of people recommend testing if a file exists and has a .php extension like this:
RewriteCond %{REQUEST_FILENAME}.php -f
Isn't the .php
after %{REQUEST_FILENAME}
redundant? The variable should already contain the .php
, right?
Seems like adding .php
after %{REQUEST_FILENAME}
would make the TestString check add an extra .php, like this:
/web/webroot/index.php.php
I'm missing something simple, I'm sure of it, but I just don't know what it is.
The context is this:
RewriteCond %{THE_REQUEST} ^.*?\.php [NC]
RewriteRule ^ - [R=404,NE,L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_FILENAME}.php [L]