Re: http header
| From: | Matt Matijevich | Date: | Fri, 16 Apr 2004 19:51:52 +0000 |
| Subject: | Re: http header | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183690@lists.php.net to get a copy of this message | ||
[snip]
Is the following code the best way to redirect someone to a different
page using PHP?
<?php
header("Location: http://www.yahoo.com");
?>
I looked for a "redirect" function of some kind and didn't come up with
anything. Just curious what the consensus is...
[/snip]
yes
http://www.php.net/header has a good way to redirect to
other pages on
your site.
header("Location: http://" . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/" . $relative_url);