Discuss: The Perfect 404
by Ian Lloyd
- Editorial Comments
12 <img>?
How about not using <img> at all as it’s presentational markup ;)
posted at 05:12 am on January 17, 2004 by David House
13 re: My Apologies
<< Sorry, didn’t know what was kosher for link making in comments here on ALA. Perhaps a short description would be useful, much like a good 404. >>
At the top of every page of the forum is this short description:
Discuss this article. HTML tags and entities display as source; they do not render. To create a live link, simply type the URL (including http://).
posted at 05:16 am on January 17, 2004 by apartness
14 Site structure & 404's
Some links you should also add to your 404: http://www.theobvious.com/archive/1998/11/02.html
posted at 05:29 am on January 17, 2004 by Jurre
15 server side
I wonder how to do the exact same thing from server side (PHP,CGI,etc). I don’t prefer Javascript though.
posted at 07:14 am on January 17, 2004 by Lim Chee Aun
16 Beware of cross-site scripting
Scripting to enhance the error page is a good idea, especially when you have limited control over the server configuration and cannot implement custom error pages on the server.
The examples seem to be vulernable to cross-site scripting, though, with referrer information written out unescaped, which may have some undesirable side effects …
posted at 11:06 am on January 17, 2004 by Klaus Johannes Rusch
17 Some more examples
At Virgin Radio, we worked hard on our 404 errors. I liked this article, but think we’re ahead of the crowd here, and we’ve some more examples you might like.
http://www.virginradio.co.uk/linktous – this page doesn’t exist, but we automatically search for possible results from the URL you gave us. Why not? It makes sense.
But if you’re going to run searches automatically, you need to make sure this doesn’t happen on non-HTML requests – it’ll kill your server otherwise! A graphics file, like
…returns a much simpler error page.
(As does a multimedia file, like http://www.virginradio.co.uk/error.asx )
We also use our 404 error code for simpler URLs for use in advertising.
http://www.virginradio.co.uk/breakfast properly directs to the correct file at http://www.virginradio.co.uk/djsshows/shows/pgbreakfast/index.html
Here’s hoping these ideas are useful. If you want to contact me further, I’m at http://www.virginradio.co.uk/thestation/contactus/?to=techies
posted at 01:50 pm on January 17, 2004 by James Cridland
18 re: Some more examples
James, thanks for sharing. That’s awesome.
posted at 05:25 pm on January 17, 2004 by apartness
19 Yes, I know...
it’s so 1997 and of little practical purpose, but I can’t avoid chuckling in front of the 404 you haven’t covered: the smart-assed 404 (eg, http://www.gamewyrd.com/archives/wyrderrors.php )
posted at 03:17 am on January 18, 2004 by quino
20 Apache mod_speling
Another addition worthy of note is that if your site is running on Apache (version 1.3 or greater) then you can enable mod_speling.
This module allows for capitilisation issues (only a problem on non-windows servers) and also allows for one spelling error.
An as example if you typed in index.ht instead if index.htm, or statd instead of stats, Apache will attempt to track down the right file or directory before issuing you the appropriate error.
posted at 06:58 am on January 18, 2004 by Rob Green
Discussion Closed
New comments are not being accepted, but you are welcome to explore what people said before we closed the door.
Got something to say?
Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.
Create a new account or sign in below if you’d like to leave a comment.
Subscribe to this article's comments: RSS (what’s this?)






11 My Apologies
Sorry, didn’t know what was kosher for link making in comments here on ALA. Perhaps a short description would be useful, much like a good 404.
posted at 04:31 am on January 17, 2004 by Will Pate