Ask a Question related to PHP Development, Design and Development.
-
Nobody #1
Pb headers
Hi,
On my page index.php (which is the default error page of my website), i
eventually show an error message which comes from the analysis of those
variables
// Code >>
$url_erreur = $_SERVER["REQUEST_URI"];
$serveur_erreur = $_SERVER["REDIRECT_STATUS"];
// << Code
On another page, i eventually redirect to my homepage if the parameters
are incorrect (this "another page" generate news and the output format
is in the parameters)
// Code >>
$mode = $_GET ["mode"];
if (($mode != "rss") && ($mode != "atom"))
{
// Redirect to index with error 404
header("HTTP/1.1 404 Not Found");
header("Location: http://localhost/me/");
}
// << Code
Problem : the error code 404 sent does not affect the server variables
and so there is no error message shown by index.php.
How could i do ?
TIA
PS : Please apologize my poor english ;-)
Nobody Guest
-
Please help me to set my headers and footers
I have to use these settings for my books. Margin In Inches Book Size In Inches 5-1/2 x 8-1/2 Top/0.7 Bottom/3.2 Left/2.25 Right/2.25... -
Headers already sent?
Hello. I just wondered if anyone has experienced this error before? "Warning: Cannot modify header information - headers already sent." ... -
Headers for ID CS?
Is there a plug-in or a script for ID CS to do running phonebook style headers (like can be done in Pagemaker)? I have one job I've kept in PM... -
curl and sent headers
is there any way of seeing exactly what headers cURL sent in a transfer, with PHP? -
[PHP] Please dirrect me -- headers ????
Hi, Headers have nothing to do with the <head> tag, the headers are sent before the html page, ie they are not part of the html document, but... -
Andy Hassall #2
Re: Pb headers
On Fri, 01 Oct 2004 23:01:14 +0200, Nobody <nobody@nowhere.no> wrote:
[url]http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5[/url]> // Redirect to index with error 404
> header("HTTP/1.1 404 Not Found");
404 - there is no resource available for this URI.
Location means the resource exists, but is elsewhere, as indicated by the> header("Location: http://localhost/me/");
absolute URL. (at least for 3xx responses anyway).
[url]http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30[/url]
Surely a 4xx status and a Location header are mutually exclusive?
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Andy Hassall Guest
-
Nobody #3
Re: Pb headers
Andy Hassall wrote:
Quote >> On Fri, 01 Oct 2004 23:01:14 +0200, Nobody <nobody@nowhere.no> wrote:
>
>>>> // Redirect to index with error 404
>> header("HTTP/1.1 404 Not Found");
>
> [url]http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5[/url]
>
> 404 - there is no resource available for this URI.
>
>>>> header("Location: http://localhost/me/");
>
> Location means the resource exists, but is elsewhere, as indicated by the
> absolute URL. (at least for 3xx responses anyway).
>
> [url]http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30[/url]
>
> Surely a 4xx status and a Location header are mutually exclusive?
>
The Location response-header field is used to redirect the recipient
to a location other than the Request-URI for completion of the request
or identification of a new resource.
< Quote
It is not said that the resource should exist. It is said "for
completion of the request or identification of a new resource". In my
opinion, it is correct to send a 404 error to indicate the resource
asked for does not exist, then to redirect the user elsewhere in order
to give him "a new resource" to look at, this resource explaining (via
an explicit message) the kind of problem encountered.
But my problem is not here. If i understood well, the 404 error
generated does not affect the server, it is simply sent to the client.
Opposite to the use of errorDocument.
So how sould i do to get the 404 code in my index.php ?
Nobody Guest



Reply With Quote

