Rasmus_Lerdoff–PHP_&_MySQL_Conference.pdf
Apache’s ErrorDocument directive can come in handy. For example, this line in your Apache configuration file:
ErrorDocument 404 /error.php
Can be used to redirect all 404 errors to a PHP script. The following server variables are of interest:
1. $REDIRECT_ERROR_NOTES – File does not exist: /docroot/bogus
2. $REDIRECT_REQUEST_METHOD – GET
3. $REDIRECT_STATUS – 404
4. $REDIRECT_URL – /docroot/bogus
Don’t forget to send a 404 status if you choose not to redirect to a real page.
Header('HTTP/1.0 404 Not Found'); ?>
Interesting uses
1. Search for closest matching valid URL and redirect
2. Use attempted url text as a DB keyword lookup
3. Funky caching
Free Ebook Download Link:Rasmus_Lerdoff–PHP_&_MySQL_Conference.pdf
