How to Create a Custom 404 Page in Apache

Custom 404 page is what a site’s visitors see while trying to access a broken link or a mistyped url.  Most of the users will choose to surf away when bombarded with a standard 404 page. A custom 404 page provides an opportunity to help people find what they have been searching for, there by letting them explore your site further.

This tutorial helps you to create a custom 404 page in apache. Before proceeding further, just make sure you already have created a custom 404 page and saved it in your website’s directory.


Setting Up of Custom 404 Page

Open up the site’s .htaccess file to edit. You will be able to create the file using a text editor and later upload it to your web using FTP.

Search for the ‘ErrorDocument’ and replace the 404.html link with your new error page link.

ErrorDocument 404 /MyNew404.html

Save and exit the file.


Note:  Apache will look for the custom 404 page with in the server root directory. You must have probably logged in as root to edit the file. In case if you created and placed the file in any other subdirectory, you will have to include path. It should look something like this:

ErrorDocument 404 /error_pages/MyNew404.html


Verify the 404 Page

Once done with the changes, you can restart your web server.

Now, access any unavailable page or a broken link so as to visit your new custom 404 page.

support2 has written 111 articles

Leave a Reply