How To Create A Custom 404 Error Page

June 15th, 2010 by admin Leave a reply »


In this article I’m going to show you how to create a custom 404 page for your website.

A custom 404 page is displayed when someone has mistyped or follows a dead link on your website, without a custom page your visitor will just get a generic server error like the one below.

The reason for creating a custom 404 page is to ensure that your website visitors find what they were looking for and do not leave your site.

It’s really easy to setup and will take less than 5 minutes.

The first thing you need to do is create a .htaccess file if you don’t already have one,
if you do have one then edit existing file and add the text ErrorDocument 404 /page-not-found.html on a new line.

1) Open your default html editor

2) On the file menu select new html file

3) In the code of the document type
ErrorDocument 404 /page-not-found.html

4) Save the file as .htaccess in the top of your website

Note that the file does NOT have a file name just save as .htaccess

ensure that the file is NOT saved with an extra extension such as .htaccess.html

Important: Don’t overwrite your existing .htaccess file if you have one, if you already have this file just add the this line

ErrorDocument 404 /page-not-found.html

at the bottom of the code and save.

Now to create the custom 404 error page.

1) Within your default html editor create a new page or open your template page.

2) In the main text area type something like “Sorry, the page your looking for cannot be found”

3) In the main text area underneath your “Sorry…” heading include some navigation links to your websites main content, sitemap or site search feature.

4) Save the file in the top of your website as page-not-found.html

5) Upload the html page and .htaccess files to your website.

6) Test to make sure it’s working type your domain name into your browsers address bar follow by a page or location that does not exist.

If all is working properly you should see the new custom 404 error page you just created.

Extra tip: Include Google analytics on the custom page and check your stats every month to see what pages or dead links are leading people to the 404 page and then you can fix them.



  1. Arun says:

    Nice information,Please visit our website

  2. ariess says:

    nice info. what about the scripts in .htaccess to redirect to previous page visited after someone cannot input the right user name or password on a page which requests them then cancelled?

  3. Ata says:

    Just received an email about this. At first, i assumed having an error page is useless as google may de index it anyway. But after reading this, i need to implement this now. Thanks.

  4. fullget says:


    Really thanks!

  5. Jack says:

    I followed instructions but do not work for me. :(
    Any further help?

  6. Jack says:

    What its mean by on top of your website? is it mean root directory?

  7. More great info,thanks.

Leave a Reply