404 Pages Done Right

Posted by Matt Johnson | 2007-11-28 22:05:28

I've seen a lot of articles and blog posts about 404 pages, and they're all pretty good. But the ones I've read don't suggest reporting where, when and how the 404 occurred, automatically.

Every 404 page should have some code that reports to you (via automatic email or DB insert) the HTTP referrer, the address of the page that received the 404 and when it occurred. A good 404 should also have the user agent details and anything else you can scrape up about the user. Sure, your error logs might tell you some of that information, but it'd be better if you got an email as soon as a 404 occurred, with plenty of detail about the error, so you could fix it right away. Make your 404 pages work for you. Don't be lazy and just offer a form for the user to fill in the details, do it automatically!

I should start following my own advice...