RE: [PHP] Re: Does Location: headers constantly
| From: | Ford, Mike [LSS] | Date: | Thu, 04 Jul 2002 10:01:50 +0000 |
| Subject: | RE: [PHP] Re: Does Location: headers constantly | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105411@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Richard Lynch [mailto:rich@phpbootcamp.com]
> Sent: 03 July 2002 21:17
[...]
>
> It's a good idea to get in the habit of doing:
>
> header("Location: xxx");
> exit;
>
> There's no point in sending any more data after the Location:
> header anyway,
I can't let this go unchallenged -- what happens if you're sending this to a
browser which *doesn't* honour the "Location: " header, but *is* capable of
displaying any attached page content? The poor user will be left with a
completely blank screen, and no hint of why. In fact, the HTTP/1.1 spec
(RFC 2616: http://www.w3.org/Protocols/rfc2616/rfc2616.html)
even says:
> Unless the request method was HEAD, the entity of the response
> SHOULD contain a short hypertext note with a hyperlink to the
> new URI(s).
So at the very least you should do something like this:
header("Location: xxx");
?>
<HTML>
<HEAD>
<TITLE>Moved to xxx</TITLE>
</HEAD>
<BODY>
<P>This page has moved to <a href="xxx">xxx</a>.
</BODY>
</HTML>
<?php
exit;
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211