Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


More on LinuxToday


PHPBUilder: Using PHP Error Handling

May 20, 2000, 21:10 (0 Talkback[s])
(Other stories by Mattias Nilsson)

[ Thanks to Kevin Reichard for this link. ]

"An all to common error on the web is broken links. You end up with broken links from other sites whenever you rearrange your site. People bookmark some page they like and come back 3 months later only to find a '404 Not Found', giving them no help whatsoever about where to start looking for the page you originally had on your site. Let's solve this, or atleast be friendly to your users and help them get back on track whenever they hit 'a 404'. You can even create a common page to report all errors you might encounter while rendering your pages."

"PHP together with Apache gives you quite alot of freedom to create your own error pages, but requires some reconfiguring and a tiny bit of coding. Let's start off with the configuration part. "

"The Apache ErrorDocument directive specifies what document (or URI) Apache should redirect a user to in case of an error. It allows you to specify one resource for each and every error code one of your users might run into. Start off by adding a ErrorDocument 404 /error.php directive to your server configuration. This will redirect users that ask for a page that does not exist to the 'error.php' page you will soon write. Don't forget to restart Apache for the changes to take effect. "

Complete Story

Related Stories: