Please i need a quick fix,
I have completed a site and I use .htaccess
to rewrite the urls to remove .php
with my intention for only known files i.e. if I have about.php
then I can have /about
it worked fine with the following .htaccess
lines
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L]
Now I created another line to handle custom 404
error
ErrorDocument 404 /404.html
Now here is the problem, I get 500 Internal Server Error
upon navigating to unknown files instead of redirecting to 404....
Apache rewriting is somehow wield so i just dont have the time now, any help please
Thanks in anticipation
Well you should be able to go to the page without the .php, so if you have like a header file or config file, just put this code up top after session stuff. You can remove the rewrite rule.
if (substr($_SERVER['REQUEST_URI'], -4) === '.php') {
require '404.php';
}