We are hosting several sites on our server. We have set a custom not_found.php file in the apache config and it works fine.
For a few of our virtual hosts, we need a custom not_found.php file. In the
<VirtualHost> section we have set a custom 404 file. When we try to access a non-existing url in that virtual host, we get a "File not found" error (not the typical Firefox 404 Not Found).
If we rename the file to .html and change it to .html in the config, it loads the custom 404 just fine (the PHP scripting doesn't work of course). So I know it is reading the custom ErrorDocument statement in the VirtualHost. And I know the path is fine. It just doesn't work with an extension of .php.
Here is the relevant config:
<VirtualHost> Alias "/error_docs" "/var/www/vhosts/domain.com/error_docs" ErrorDocument 404 /error_docs/not_found.php </VirtualHost>
PS. PHP scripts work throughout the sites (so we know PHP is working fine).