Change 404 Page on Apache – Linux

  • by

Use the ErrorDocument directive in your conf file to set a custom error message.

The easiest way to do this:

  1. Create a file with your custom error message. Save it in:
    vim /var/www/not_found.html
  2.  Edit  vim /etc/apache2/httpd.conf :

    Find the line that says:
    #ErrorDocument 404 /not_found.html

    Remove the leading “#”.
    ErrorDocument 404 /not_found.html

    Save.

  3.  Restart apache.
    /etc/init.d/apache2 restart

Done!