note 90945 deleted from function.header by danbrown
| From: | danbrown@php.net | Date: | Fri, 14 Aug 2009 04:22:39 +0000 |
| Subject: | note 90945 deleted from function.header by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159467@lists.php.net to get a copy of this message | ||
Note Submitter: andre at luyer dot nl
----
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;
?>