skip to Main Content

Our PHP installation is intercepting 404 Page Not Found errors and displaying this basic and generic 404 error message on pages with the .php extension:

File not found.

It is preventing the requestor from seeing our nicely formatted ERROR 404 Page.

How do I shut off the PHP setting to have the server use our Apache directives for 404’s?

Here is a screenshot of the nicely formatted 404.

Here is a screenshot of the 404 that does not the follow Apache Directives.

3

Answers


  1. I would start looking at the apache conf files (all the conf files in the apache folder i.e. in /etc/apache2 as example, or all the vhost files configuration that should be in something like /etc/apache2/sites-enabled or similar)
    if nothing is helping there then
    I would start from having a look at the .htaccess files

    as I remember there is nothing in the php configuration that is telling to intercept the 404

    Login or Signup to reply.
  2. Check your .htaccess file. Check if custom ErrorDocument is set. For example:

    ErrorDocument 404 /file-not-found.php
    

    In addition check if there any redirects matching pages having .php extension. For example:

    RewriteCond %{THE_REQUEST}  /+[^?]+.php
    RewriteRule ^ - [L,R=404]
    
    Login or Signup to reply.
  3. Due to enabling the mod_proxy_fcgi and using PHP-FPM this might happen.The default error page in the proxy is File not Found. Try adding the following in your http.conf or apache.conf

    ProxyErrorOverride On
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search