I have a .htaccess file like this right now. It sends everyone to the index page unless you wanted a real file. This is sort of what I want, but I dont want anyone to be able to access a .php file. So this is what I have:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*) /index.php [NC]
But this is what I want:
if(file_exists(request) && !request.endsWith(".php"))
do not redirect request
else
redirect to index page
This is what I tried:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule !(\.php)$ /index.php [NC]
But if i type in the real location of a php file, it still tries to load it. I can always add a few lines to the top of every single php file asking what PHP_SELF is. If PHP_SELF isnt index.php, then I redirect them to the index page. But i think .htacess can do this better.