RossOlson.com

Error Pages: The 404 Experience

404 pages have always been (and will always be) with us. You can't stop people from mis-typing URLs, and you may not be absolutely always put up pages that are perfectly linked, and even if you do, a year later when you move that directory, those links will likely break and crumble like eggs for an omelet.

   If your site has been around for any length of time, people will have linked to certain pages. When I worked at OMSI many people had linked to a wide variety of resources on the site. Under the hood however (because the site had developed organically) the various parts of the site were getting more and more difficult for the web developer to wrap a brain around. The locations for certain files could have been anywhere, and the directories of the files didn't match up with the hierarchy of the information on the site.

   There were other problems as well. Many directories did not have default pages (index.html or default.html) so those needed to be added. Some pages had the extension .htm rather than .html. These are travesties by any means, but the more organized a site is, the easier it is to jump into and work with.

   To bring uniformity to the site, I had to move pages to new directories, change filenames and directory names. This was going to break links, it was obvious.

   (Many of the changes could have been done by modifying the configuration file for the Apache web server, but while that worked for certain directories, I wanted robots and search engines to update their links as well. I didn't want these patches to be _too_ transparent.)

So what's a self-respecting web developer to do? You're supposed to make it easy for people to get to where they want to go. And if possible, send them there automagically, but if not, you ought to give them a range of options for getting there themselves.

   (Modifying the default 404 page varies by web server. In Apache, you create a file with the name '.htaccess' with the following line in it: ErrorDocument 404 /error404.html. This .htaccess file can often be put in customer directories (like those that have a ~ in the address). For MS IIS, there are pages created during the installation that you can modify.)

Here are some of the techniques I used on the 'File Not Found' error pages, aka the 404 page:

   1) A common problem with some sites is the use of a non-standard extension on their page's filenames. On this site I use '.shtml' but people often incorrectly type in filenames with '.html' instead. Suggesting the visitor manually change their URL isn't very elegant, but it does give savvy surfers an understanding of what changes they might make of their own. A better solution would use JavaScript to modify the URL automagically. This site's error pages already do that. The script will only launch if they have new browsers where the JavaScript can work it's magic. If the magic doesn't work, the browser could drop to using the next script.

   2) I added a JavaScript that automatically chopped off the entire filename of the URL and then redirected the browser to the new URL. Because the site's information hierarchy and file system hierarchy are in sync, this brought the user to the parent page of whatever information they were trying to access, usually the index.html page. This page, as a rule, has a menu of all the pages (html files) and sections (sub-directories) that are available beneath it. In essence, if a URL (location) creates an error, the user is dropped to the nearest menu for that section. I have made the scripts for Step 1 and Step 2 and some documentation available.

If the JavaScript fails, or the directory that they pointed to doesn't exist, then they are presented with the actual 404 error page. On this page they are given 3 options: They are told to manually change the URL (just in case their older browser could use the JavaScript in step 1), they are told to look through the Site Map, or they are asked to send an e-mail to the webmaster for personal help. (example)

   3) Show them a site map, or or at least an obvious link to it, and give them the option to use the local search engine, if there is one. Make sure to keep your site map (really a site index) up to date, and make sure the search engine is working well.

   4) Tell them who to contact. The last option should give them the option to talk to a real person. It's been my experience that you don't get a lot of people getting this far in the process, because you've already given them a lot of tools to fix their problem on their own.

   5) Another tool that you may add if you find yourself dropping content from your site is a Web Trash Can, which I've defined in greater detail here.

   6) Humor. No one likes to be lost, or not be able to find what they want. On the OMSI 404 page I added a Web Haiku that was taken from Salon Magazine. No one likes errors, but they might as well buoy the spirit rather than bring it down further.

   These are some of the options you can give your visitors, and they're the ones that I use the most often. Remember: Make your error pages Useful and Light-hearted. This will make your visitors feel powerful and happy.

Further Reading... Some suggestions and examples of 404 pages: Improving the Dreaded 404 Error Message by Jakob Nielsen (Thanx to Lawrence Lee), Slashdot's 404 helps you fix misposted URL from their discussion boards. From Webmonkey I was pointed to Pliko.net's Great 404's page.

P.S. Keep an eye on your error log. By looking this over, you can often find where people are going wrong and not finding what they want from you. Use this information to patch and error-proof your web site.



 
 

[ Read and write comments ]