Better 404 Not Found Pages

Often times “404 not found” pages aren’t particularly helpful. They tell you that the page is gone, and not much else. The more tech-saavy know a great trick to help find what you’re after: just lop off a hunk of the URL. Perhaps you had a bookmark saved at this address, for example:

http://tenseforms.com/tundra/winter.html

You open your bookmark, and sadly, the page no longer exists. But you know the content may still be there… Perhaps it has simply moved to another page. You can do some digging just by removing everything after the last slash:

http://tenseforms.com/tundra/

Sure enough, you go to that page, click on the songs link, and there’s the song you were after: the edge of winter transforming. Unfortunately, not everyone will know to do this. Some people may simply give up after seeing an error message. They may even assume the whole site is gone.

I have a little script I use to help people find things this way. If you clicked the first link you’ve already seen it in action: the page will automatically suggest checking the second link. This custom error page simply takes chunks off the end of the URL, checks if the directory exists, and if it does it offers the link to the visitor.

You can view the script I use for my own site here. To use this on your site, just change the domain variable at the top, and adjust the text at the end as necessary. You’ll also need an .htaccess file with the following line:

ErrorDocument 404 /404.php

This assumes the file is named 404.php and you’ve placed it in your document root. If you’d prefer something else, just change the path as necessary.

If you have any other ideas for more helpful error pages, I’d love to hear them. Another great idea I’ve seen is to offer search results based on the original URL. Using the example above, the script might offer other pages that contain the words “tundra” and “winter”. Quite helpful! Subtle touches like this can save time even for people that already know the tricks of finding lost pages, and that will help keep them at your site, instead of going elsewhere.

07.16.05: A List Apart has a nice article on this subject.
04.15.06: Mike Davidson has some great ideas as well.

Comments

This entry has one comment.

Scott

Scott wrote on June 13, 2005:

I really like the site design, Mike. Good work.

View more

Code

VoiceOver tips for iPhone developers I’ve been working on improving VoiceOver support for Delivery Status touch 3.0. It was…

My First WWDC Above: Apple’s live App Store wall at WWDC. It showed icons of 20,000 iPhone apps,…

Displaying a password or text entry prompt on the iPhone Writing your own iPhone or iPod touch app, and wondering how to create an alert like…

Junecloud: coming soon