note 23791 deleted from function.header by sniper

From: Date: Sun, 07 Sep 2003 21:30:23 +0000
Subject: note 23791 deleted from function.header by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55607@lists.php.net to get a copy of this message
Note Submitter: bilse@NOJUNK.qbfox.com ---- Most people have been stumped by that, I think, but it's quite simple: The message you expect to see in your browser (either the canned "The requested URL blaah was not found on this server" or a custom error page) is served up by Apache when it can't find what was requested. The message is not generated because a 404 (or other) header somehow went through the pipes. The message is simply a human-readable version of the HTTP 404 header, supplied by Apache as a kind of courtesy in addition to the header, when it couldn't find what it was looking for. Now, when you generate your own headers from within PHP, Apache isn't going to do anything. It doesn't inspect the headers you generate, and if you generate a 404 (or other) error header, it isn't going to tag any kind of human-readable message onto what you produce. As far as Apache is concerned, there is no 404 (or other) error condition -- after all, it found what was requested in the URL, and served it up. Hence, for the user to see a 404 message, you need to produce some HTML yourself, in addition to sending the status header. If you don't use a custom ErrorDocument, it's quite easy to mimic Apache's standard response. Otherwise, simply include() your errordocument after you've produced the headers.

« previous php.notes (#55607) next »