How To Set Up a Custom 404 Page Not Found Message for Your Website

by Don Campbell on May 24, 2008

When someone comes to your website by typing in a link (URL) that does not exist, or following an old or broken link, they will most likely get a standard “404″ Page Not Found error message from your hosting provider. This page probably contains advertisements that the hosting provider makes money on (not you!)

Here is the standard Error 404: Not Found! error message my hosting provider displays:

Standard 404 Page Not Found Result

It’s a little more professional - and fun - to provide your own custom message, maybe apologizing for the inconvenience and providing some links for the visitor to follow to get back on track.

I just went through the process of setting up a custom Page Not Found message (aka HTTP 404 Error) for Expand2Web and want to share the steps of how to do it for your website too.

The Steps

First, you’ll want to make a custom page that visitors who go to the wrong link will see. On this page, it’s a good idea to include a header or logo for your website and a custom message to your visitors explaining what happened. You’ll also want to include some links to help get them back on track and stay on your website. Here are the links I decided to include:

  • A basic Site Map, which is just a set of links to other areas on my website, like the home page, blog, and a few other links of interest.
  • A Search Box - I decided to implement a Google Custom Search Engine for all the Expand2Web properties, so that if the visitor is looking for something specific on my websites, she could quickly search all my websites from here. You can also hook the searches up to Google Analytics, so that you can track all the search queries that people type in on your site. This is a very valuable piece of information! I’ll be writing a separate post later this week on how to create a custom search engine and hook it up to Google Analytics. It’s easier than you might think.
  • Contact information - To make it easy for a visitor who ended up here to report a problem or ask a question.

Here is a link to my custom “404″ page for Expand2Web.

Custom 404 Page Not Found Error result for Expand2Web

The Tricky Part

Now for the trick; how do you get this custom page to show up when a visitor encounters a 404 Not Found error on your site?

You’ll need to edit the Apache .htaccess file on the root of your web directory. If you have access to this file, it’s easy to make the change. All you have to do is add the line:

ErrorDocument 404 /notfound.html

This tells your web server to redirect the visitor to your custom page any time they encounter a 404 Page Not Found.

Most likely you’ll need an FTP program to access this file. Some web hosting providers give you a web interface to do this. Make sure you add this line without changing any of the other lines in the file.

Now, when someone accidentally types in or follows an invalid link to your website, they’ll be greeted with a custom message and some helpful links that keep them on your site instead of giving up and wandering off somewhere else on the net!

If you have questions about this, leave me a comment and I’ll do my best to help out :)

If you're new here, you may want to subscribe to my RSS feed or Email updates. I'm also on Twitter. Thanks for visiting!

{ 1 comment… read it below or add one }

Don 05.25.08 at 6:06 am

Great Article, Thank You.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>