I am trying to set up a custom error page for 404
error on my apache server.
Here is what I am included in the Virtualhost
<VirtualHost *:80>
ErrorDocument 404 /var/www/html/mant.html
</VirtualHost>
But this page is not showing instead its redirect to default 404 page
Note:
I've restarted the apache with sudo service apache2 restart
I am able to access the error page with the following url
<ip>/mant.html
Best Answer
Your current configuration expects the custom error page to be found on
http://www.example.com/var/www/html/mant.html
.The path to the ErrorDocument is an URL path, either relative to your DocumentRoot:
or an absolute URL such as:
it is not a path on your file-system.
Edit: Based on your comment
Then store your error pages outside of the DocumentRoot where they won't be deleted: