Creating a 404 “Not Found” Error Page

If you’ve been on the Internet long enough or if you have a website yourself for a decent amount of time, you’ve probably heard of or encountered 404 “Not Found” error pages. This is a page you encounter when you go to a URL that does not exist; the requested resource may not exist because it was deleted, the URL was misspelled or the resource was moved. You might have also encountered being redirected to another page that is different from the resource URL you requested.The majority of the time that error is caused by the website owner and not the user requesting the resource.

It is also worthy to point out that the 404 “Not Found” error page does not mean there is a problem with the server, in fact it means the user was indeed able to communicate with the server but the server could not return the requested resource. The 404 “Not Found” error page is a client error and not a server error.

Options in Dealing with Not Found Resources

There are several options that you could employ in dealing with not found resources that do not require displaying a 404 “Not Found” error page. Let’s explore them:

Redirect to Homepage or Another Page?

You may think that redirecting to the homepage or a related page maybe the best way. In fact, you should avoid redirecting the visitor to your homepage, because it leaves a dissatisfying feeling to the visitor because they could not find what they were looking for; you didn’t tell them why they are not viewing what they wanted and how-to find what they wanted – and if what they wanted does not exist anymore, what they could view as an alternative.

You could potentially redirect the visitor to a best alternative resource, and this could leave the visitor satisfied or somewhat satisfied, but it still doesn’t tell them why they are not viewing what they wanted. With this being said, this could potentially be an option, if what was requested had a lot of backlinks / requests. This would require analytics checking to see if pageviews increased or decreased and what the bounce rate and visit duration is. We want the visitors to stay on your website and you might want to do comparison testing with a 404 error page which I’ll show you how-to create below.

Resource Still Exists, It’s Just the URL Structure Changed

If the resource still exists but it has moved, meaning the URL structure has changed, simply create a 301 redirect. In your .htaccess file we could create rewrite rules like so:

Redirect 301 /old-page

Where /old-page is the old page, with the relative path to the public directory, i.e. public_html or www.

We could also create a code snippet in .htaccess that will redirect every resource in ABC directory to another directory where the resources now reside.

RedirectMatch 301 /ABC/(.*)$1

Creating a 404 “Not Found” Error Page

The server will display a 404 error page if you have not defined one yourself, which can easily be done through .htaccess, like so:

ErrorDocument 404 /404.html

Where /404.html contains the URL to the error page, relative to the public directory, i.e. public_html or www, and the file name.

Required Elements of a Great 404 “Not Found” Error Page

Your 404 “Not Found” error page should provide three (3) things: 1) that the resource could not be found, 2) why the resource could not be found and 3) provide the visitor with several options in finding what they want or an alternative to what they want or what interests them.

Example titles you could use is:

  1. 404 Error Page;
  2. Not Found
  3. Sorry, we couldn’t find what you wanted;
  4. What you wanted has been moved or removed.

If you are using example one (1), two (2) or similar, make sure you explain what a 404 error page or not found page is. You could also add a little comedy to the titled like “Four. Oh. Four.” In order to lighten things up.

Make sure you list reasons why a resource could not be found, if it isn’t a part of your title.

Underneath the title (and explanation) you should provide several options that the visitor could use to find the resource they wanted, a resource that is similar or a resource that would satisfy their need.

Examples of options you could provide:

  1. Search;
  2. Related resources based on keywords or category of the not found resource;
  3. A list of all categories and / or pages;
  4. Contact form or a link to request help.

I would recommend if you are linking to a help page or contact page, that the page be opened in a new window, thus keeping the visitor on the 404 “Not Found” error page. Or if, the contact form is “embedded” on the error page, display a success form submission message or redirect the visitor back to the error page. Why? To keep the visitor on your web page. If the visitor submits the contact or help form, they most likely will leave – it’s a last option you should provide to keep a visitor as satisfied as possible. Leaving the 404 “Not Found” error page open, it still gives them an opportunity to explore your website while they wait for your response.

What Not to Include in a 404 “Not Found” Error Page

You should avoid annoying or unprofessional elements, like image animation. We want the error page to appear professional and like any other page.

Preventing 404 “Not Found” Error Pages

A great way of preventing visitors from experiencing a 404 “Not Found” error page is by using Google Webmaster Tools.

Login to Google Webmaster Tools and click on the domain name. Next, on the left sidebar menu, click on “Crawl.” A menu will drop down. Click on “Crawl Errors.” On the page you’re taken to, look for a section called “URL Errors.” You’ll see a grey tab menu. Click on the option “Not Found.” It’ll most likely be the only option or the last option (if different error types occurred). You’ll see a list of not found resources.