I have a personalized page for 404 with htaccess
ErrorDocument 404 /404.php
It works fine, but it takes everything .jpg, .js, .css etc...
I would like it to just take the .php and do a normal 404 error for all others.
I didn't find that option anywhere.
Thank you very much.
Not sure but give this a try:
Quote from Files Directive documentation:
Utilizing the
$_SERVER['REQUEST_URI']
, you can easily check the ending of the file that resulted in an error and then throw a header to a normal 404 if it doesn't correspond to your needs or just render a different 404Put this in your 404.php file
There are a few possible approaches to this, but I would do one of the following:
You can use
mod_rewrite
, as suggested by @LazyOne, to redirect only files with a.php
extension to your custom document:Or you can direct everything through the PHP error handler as you already do, and use PHP to determine whether the requested resource is a PHP script or not:
The disadvantage of this second approach is that you may need to rewrite the standard error document so that it used PHP to get dynamic information to display to the user, such and the requested resource path.