note 78967 deleted from function.header by tularis
| From: | tularis@php.net | Date: | Mon, 05 Nov 2007 07:31:10 +0000 |
| Subject: | note 78967 deleted from function.header by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-132008@lists.php.net to get a copy of this message | ||
Note Submitter: Dazza
Reason: useless
----
This happened to me with PHP5.
I couldn't work it out and then I read a post which gave me this code.
I changed it into a function... may need modifications made if you want to redirect outside your own
server.
function redirect($page){
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
header("Location: http://$host$uri/$page");
}
this is to be called with an exit clause afterwards.
This applies especially if you have more than one redirect in the same script.
Example...
if($this != $that){
redirect('mypage.php');
exit;
}