Error 404 PHP File
The Error 404 page is widely used to direct an invalid request to a friendly page, offering advice. The Apache error log file is commonly monitored to keep an eye on the types of errors which are being logged.
Normally, no more than the above is required. But occasionally, such as when a major overhaul of the website structure has been undertaken, it is useful to take a more proactive interest in the errors which are being logged, and this PHP facility is designed to help to do just that.
It is a PHP file containing a standard Error 404 page prefaced by some PHP code. This code enables you to optionally email details of a logged error to yourself, and optionally log some of the salient details to a file in a format which is easy to analyse. Both facilities are enabled by flags so they can be easily switched on and off. The nominal Error 404 HTML at the bottom of the PHP code should be replaced by your own HTML Error 404 page.
To activate the facility, put the Error 404 file in your top directory, and include the following lines in your Apache .htaccess file:
# Error page ErrorDocument 404 /error404.php
Download Zip File (1,124 bytes).