note 90945 added to function.header
| From: | andre at luyer dot nl | Date: | Sun, 17 May 2009 19:38:16 +0000 |
| Subject: | note 90945 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-155247@lists.php.net to get a copy of this message | ||
The loaction header must contain an absolute URI!!
See note above "Note: HTTP/1.1 requires an absolute URI as argument to » Location".
Thus:
<?php header("Location: /home.php"); ?>
is wrong, but most browsers will follow it correctly (hence the common mistake).
This is correct:
<?php
header("Status: 301"); # 301 Moved Permanently
header("Location: http://{$_SERVER['SERVER_NAME']}/home.php");
exit;
?>
----
Server IP: 91.199.167.18
Probable Submitter: 84.245.6.177
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/90945
Del: integrated -- https://master.php.net/note/delete/90945/integrated
Del: useless -- https://master.php.net/note/delete/90945/useless
Del: bad code -- https://master.php.net/note/delete/90945/bad+code
Del: spam -- https://master.php.net/note/delete/90945/spam
Del: non-english -- https://master.php.net/note/delete/90945/non-english
Del: in docs -- https://master.php.net/note/delete/90945/in+docs
Del: other reasons-- https://master.php.net/note/delete/90945
Reject -- https://master.php.net/note/reject/90945
Search -- https://master.php.net/manage/user-notes.php