an easy way to manage all your Apache/IIS error messages from one file. Just had it lying around so I thought I'd post it.
But how would this work though for server generated errors, for example, going to a file that doesn't exist? Possibly mod_rewrite might do it... fool the server to going to 404.shtml when the file is really error.php?type=404
If you don't have access to .htaccess, you can't use it. The only reason I said IIS in my original post is because I believe you can define custom error pages from inetmgr (and some windows hosts support PHP)
thats pretty cool...
diving into php here, and as simple as that snippet is i think it just made a couple things a little more clear for me... thanks...
(prolly not the place to put this but, i stumbled across it searching for an answer so i thought id risk postin it...)
On the subject of PHP and Error handling.... can't ya do this little JS error tailoring action server side in a pretty simple fashion so as to avoid the shortcommings of <noscript>?
(sry to post basically a question in here, but i thought if that was touched on it might make this thread even more great!)
"If HTML and the Web made all the online documents look like one huge book, RDF, schema, and inference languages will make all the data in the world look like one huge database"
-Tim Berners-Lee, Weaving the Web, 1999
Thats true. But what if your APACHE doesn't allow you to change error pages? For example I have a free PHP host that allows .htacces and mod_rewrite but adding 404 pages just dissapear because they have they're own. Using mod_rewrite you can still achieve the same result.
Also if you don't have APACHE at all, or don't have access to it you can still use it if you have a dynamic include functions. If the file doesn't exist, you simply include the proper error instead.
There are plenty of ways to use this without APACHE as even some scripts have they're own defined 404 pages which can be altered to this script as well.
The only problem with this is, you don't really need the manager considering if you are doing things for the site it would usually only be a 404 error, all other errors will still be handled by the server if you don't have APACHE and define the new pages.
Ok, so in your case mod_rewrite would be the best option, but its still basically the same principle as the error document except that mod rewrite doesnt mark documents as errors... The browser assumes everything is ok, so you should then send HTTP headers in the PHP script.