Custom 404 shows "File not found" for php files instead of redirecting
I suspect the difference is that php files launch the interpreter while html files are just served. A solution that works but might not be the only one or the best one is to add this directive to the host configuration file:
ProxyErrorOverride on
This happens because you might've enabled the mod_proxy_fcgi and you are using PHP-FPM. The default error page in the proxy is File not found
. So add the following to your httpd.conf or apache2.conf, not to your .htaccess.
It makes your .htaccess file's ErrorDocument
directive to override the default Proxy error page.
ProxyErrorOverride On
Thanks.