Creating answers for the requests to the requests to your web server can sometimes be a hassle. 404s are the easiest - with a simple Apache directive, users can be directed to a nice simple page telling them of the error. Most of the others can be handled similarly, but this article might just be a better way.
In HTTP conditional requests in PHP presents an abstract for a class that will handle these errors gracefully with a minimal amount of work on your part. He does give a bit of sample code to handle these errors, and some simple examples to show variants on the normal HTML response page.
Code like this can be expanded just about any way you see fit, including (but not limited to) customized response pages with "guesses" for what the user wanted, simple redirection to a main page, or even a full-fledged error system ("how can we help you find what you want?"). The possibilites are limitless...
Thanks to PHP Magazine for the link.




