If you want to invest a bit more effort in your 404 functionality, and you
run Apache, you can have your Web server check for misspelled URLs on the
fly. Apache's mod_speling
(yes, one l) module is designed to do just that. It's not compiled in by
default, so you will have to recompile Apache (or convince your Web host to
do so) if you want to have access to this feature.
With mod_speling compiled as a module in your Apache installation, you can
turn it on by including the directive ...
SpellCheck on
... in your .htaccess file.
The behavior of this function is: Apache compares the incorrect URL to all
the available files on the site. If Apache finds a single match for a
misspelled URL, it automatically redirects the user to the correct page; if
it finds more than one possibility, it presents a list of choices to the user.
By default, the list is presented in simple Apache style. You can spruce it
up, parse it, et cetera for your users if you like, though, with a bit of
code. When Apache finds a misspelled URL, it sends status code 300. You can
trap this and handle it yourself with an .htaccess line like:
ErrorDocument 300 /errordocs/300.php
The list of possible correct spellings of an URL is contained in the
environment variable $REDIRECT_VARIANTS. Grab this variable and parse it
for your users with a script you call 300.php, and you can have a beautiful
"Maybe you meant" list, formatted as you like it, with your logo at the top
and a search box at the bottom, and meanwhile you can log common misspellings.
If you want mod_speling-type functionality on an IIS site, it's Port
80 to the rescue once again. Its URLSpellCheck
product provides a similar service to Microsoft-driven
sites, at a much smaller cost.
Last, but most emphatically not least, if you crave attention, you can
always make your 404 page fun. Blundering around the Web, one can find 404
pages with random pictures, arcade
games, interactive
fiction, animation, haiku, and heaven knows what other millions of
brilliant ideas.
Here are a bunch, well-designed
informative ones as well as entertaining ones. There's something pleasingly
perverse about having your page-not-found page be the main attraction on
your site, isn't there?