Re: 404 documents
| From: | Dash McElroy | Date: | Wed, 30 Oct 2002 00:43:21 +0000 |
| Subject: | Re: 404 documents | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16617@lists.php.net to get a copy of this message | ||
From Rasmus' tips and tricks presentation at PHPcon:
(www.lerdorf.com/tips.pdf)
Apache's ErrorDocument directive can come in handy. For example, this line
in your Apache configuration file:
ErrorDocument 404 /error.php
Can be used to redirect all 404 errors to a
PHP script. The following server variables are of interest:
$REDIRECT_ERROR_NOTES - File does not exist: /docroot/bogus
$REDIRECT_REQUEST_METHOD - GET
$REDIRECT_STATUS - 404
$REDIRECT_URL - /docroot/bogus
Don't forget to send a 404 status if you choose not to redirect to a real
page.
<? Header('HTTP/1.0 404 Not Found'); ?>
-Dash
Egotism is the anesthetic given by a kindly nature to relieve the pain
of being a damned fool.
-- Bellamy Brooks
On Tue, 29 Oct 2002, DaMouse wrote:
> I there a way to have the .php page pickup the url that was typed in e.g.
> usertype= www.mydomain.com/wRongurl
>
> $_SERVER[FILE_NOT_FOUND] = www.domain.com/wRongurl
>
> echo "The lost page was: $_SERVER[FILE_NOT_FOUND]";
>