It was a route I had driven hundreds of times. I knew just the turns to take to get me to my destination. But on this particular day my well-known route suddenly turned into a dead end. As I tried to turn down one of the streets I saw the dreaded “Road Closed” sign. There was no detour sign — just the Road Closed sign, a silent guardian preventing my passage. I sat and thought for a moment, trying to remember alternate routes to get to where I needed to go. Unsure of the side streets, I turned the car around and headed back out to a larger road to try and find another way around.
The internet is full of dead ends like this one — hyperlinks pointing to web pages that no longer exist. More often than not, visitors trying to click through to one of these dead ends get the dreaded “Page Not Found” error — a message that’s about as helpful as a Road Closed Sign without a detour.
Who creates these unfriendly messages anyway, and what can a webmaster do about it? Let’s start with a brief explanation of Page Not Found errors.
The 404 Page Not Found Error
Every web server is programmed to retrieve requested pages for visitors who come to a website. Think of the web server as a librarian — you walk into the library, ask for a book, and the librarian goes to look for it. If she finds it she brings you the book. If she doesn’t find it she’ll tell you she can’t locate the book in the library.
When a web server can’t locate a requested file, it’s referred to as a 404 error, also known as a page-not-found error. By default, the web server just puts up a very unfriendly — and unhelpful — page that says something to the effect of “404 Page Not Found — the requested document was not found on this server.” No suggestions on similar page titles, no offer of helping you find the file.
You may be wondering why webmasters allow such errors to show up.
Why Do 404 Errors Happen?
Page-not-found errors happen for several reasons. First, websites are constantly changing. New pages get added, old pages get deleted, file names change for various reasons. But other websites linking to a site don’t necessarily know about these changes. They have links on their sites that point to the old pages and don’t always get notified when a page is removed or renamed. Because of the nature of the internet, it is impossible to notify all the outside sites about your changes.
Another reason for 404 errors is simply human error — somebody mistypes a file name when trying to get to a web page. The web server isn’t smart enough to know that when the user typed “terminul.html” they really meant “terminal.html” The computer just sees that there isn’t an exact match of the file name and returns a 404 error.
There isn’t much we can do to prevent people from mistyping a page name, but we can at least find out what page requests are causing the 404 errors.
How Can I Find Out What’s Causing 404 Errors?
Every time a web server fails to find a requested page, the event is logged in a special file on the server. You can use a server-side analytics program to review these logs and get a list of 404 errors. Using this list, you can see if users are consistently trying to locate the same non-existent file or if the problems are more random and caused by human error.
One of most important pieces of information you can glean is whether you have links on your own website that are leading to 404 errors. Once you know what file name the server isn’t finding, you can review your web pages for references to this file and update the links accordingly.
Even with the best link tracking and notifications, running into an occasional 404 error is inevitable. You can’t eliminate it but you can at least help your site visitor get to where they were trying to go.
How Do I Gracefully Handle 404 Errors?
You don’t have to live with the unfriendly, generic error page that’s installed on your web server. You can create your own custom error page and tell the server to display your custom page whenever a 404 error occurs.
Your custom page should first tell the user that the page you’re looking for doesn’t exist. But this, of course, is just the bare beginning. To really make your 404 page user-friendly, you need to give the visitor some assistance in getting where they really want to go. You could do this in several different ways.
Provide a site map
The first and easiest solution is to simply include a list of all the pages on your website on the custom error page. Each page title would be a link to the actual page. Presumably, a user could look at the list of pages that DO exist and click on the one they were looking for.
Give them a search box
Another option, which may require some additional work, is to give the user the option of doing a search of your website. If your site already gives users the ability to search the website, it should be fairly simple to copy this search functionality and include it in the custom error page.
Make an educated guess
A more sophisticated option could be to look at the name of the page that was requested and do a keyword search of the server files to see if another page with a similar name might be the one they’re looking for, and display a link to that page as a suggestion.
Keep a cross-reference of old page names
And the most time-intensive option of all would be to somehow keep a database of all pages that used to exist on the site and cross-reference them to existing pages. The issue here is that you would need to constantly update this database to keep it current.
For most webmasters, a simple “table of contents” or search-enabled error page will be sufficient to reduce your site visitors’ aggravation.
404 errors on the internet are as inevitable as road construction in summer months. You will never be able to eliminate 404 errors, but you can at least be more helpful than those unfriendly Road Closed signs. If a website visitor reaches a dead end on your site, give them an alternate route to follow by creating a custom error page. After all, you want to keep your visitors cruising around on your site for as long as possible.