Customizing error messages in apache2

Add this line
 errorDocument 404 /error_pages/404.html
to
 /etc/apache2/sites-available/default file – if it is applicable for the entire site
 (or)
 .htaccess file - if it is applicable to the particular application
(In the above case AllowOverride All or AllowOverride redirect should be present i/etc/apache2/sites-available/default file)

In this case, 404 error is getting redirected to 404.html file in error_pages directory.
Now create a file called 404.html file in error_pages directory in /var/www
404.html should contain the following:
<html><body><h1>It works!</h1>
<p>The requested site is under maintainence.</p>
</body></html>

No comments:

Post a Comment