An interesting Apache configuration trick is that you can tell Apache to pass requests that generate a given error to a PHP script.

httpd.conf
ErrorHandler 404 /error.php
Later on we will use this to do some very interesting things.