In a new posting from Chris Shiflett today, he talks about how to handle 404 errors with PHP.
Over at Chris Shiflett's is a post that shows you how to handle 404 errors with PHP. "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:
As usual, Chris is very keen on feedback. So, let him know if you have a more flexible error script, which can be
implemented with less hacking.
It's not an overly complicated hack, but sometimes those are the best. It's cleaner than a lot of the 404 solutions that I've seen, but, as mentioned, there could be something out there a bit more flexible...




