Accessing a non-existent php file on the web returns File not found

When accessing a non-existent PHP file on the network, it returns “File not found”. For example, if the file “2.php” does not exist, it displays the “File not found” error! However, when accessing “2.html”, it returns the normal Hestia error page. Why is it not showing the default Hestia 404 page? Where do I need to set it so that it displays the default Hestia error page? Thank you!

Can anyone tell me where to configure php?

Did you setup an template/app?

No configuration changes

You receive the error File not found instead of default 404 error page because the error is not managed by Apache2 but PHP. If you want Apache to manage those errors, you can use this directive:

ProxyErrorOverride On

That directive can’t be added to .htaccess files so you would need to modify your conf (the context where the directive can be used is; server config, virtual host and directory).

Here a quick way to do it:

Note: in the example, the user is test and the domain is example.net.

echo 'ProxyErrorOverride On' > /home/test/conf/web/example.net/apache2.conf_ProxyOverride
ln -rs /home/test/conf/web/example.net/apache2.conf_ProxyOverride /home/test/conf/web/example.net/apache2.ssl.conf_ProxyOverride
systemctl restart apache2

If it is https, should apache2.ssl.conf be configured?

Check again the example, it creates both files, for http and https.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.