note 20809 added to function.header
| From: | chamele0nDOT1ATemailDOTcom at php2 dot chek dot com | Date: | Wed, 17 Apr 2002 03:10:29 +0000 |
| Subject: | note 20809 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29457@lists.php.net to get a copy of this message | ||
just made this for http1.1 compliant use of location: header redirections
function redirectTo($newUrl)
{
// TODO: protocol possibilities need to be extended to indclude any other
// desried protocols - ftp:// mnp:// whatever...
$newUrl = trim($newUrl);
if (!(strpos($newUrl, "http://") === 0 || strpos($newUrl,
"https://") === 0))
{
$newUrl = "http"
. ($_SERVER['HTTPS'] == "on" ? "s" : "")
. "://"
. $_SERVER['HTTP_HOST']
. (strpos($newUrl, "/") === 0? $newUrl :
dirname($_SERVER['PHP_SELF']) . "/" . $newUrl);
}
header("Location: " . $newUrl);
exit();
}
--
http://www.php.net/manual/en/function.header.php
http://master.php.net/manage/user-notes.php?action=edit+20809
http://master.php.net/manage/user-notes.php?action=delete+20809
http://master.php.net/manage/user-notes.php?action=reject+20809