|
This post originated from an RSS feed registered with PHP Buzz
by Chris Shiflett.
|
Original Post: Handling 404 Errors with PHP
Feed Title: Chris Shiflett's Blog
Feed URL: http://www.feedburner.com/fb/static/error.html
Feed Description: Author, Consultant, Programmer, Speaker, Trainer
|
Latest PHP Buzz Posts
Latest PHP Buzz Posts by Chris Shiflett
Latest Posts From Chris Shiflett's Blog
|
|
The PHP site does some nice trickery with 404 errors (plus 401 and 403). This is what accomodates short URLs like http://www.php.net/security. Want to do something similar on your own site? I see people asking how to do this all the time, even though the entire site is open source. Just have a look at the error.php script and write something similar for your own site. Use Apache's ErrorDocument directive to have your own error.php script handle any error code you want:
ErrorDocument 401 /error.php
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
If you have a more flexible error script that people can implement with less hacking, feel free to let me know (or just leave a comment).
Read: Handling 404 Errors with PHP