Re: http header
| From: | Torsten Roehr | Date: | Sat, 17 Apr 2004 14:17:43 +0000 |
| Subject: | Re: http header | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183714@lists.php.net to get a copy of this message | ||
"Gabe" <ydnahg-news4432@mailblocks.com> wrote in message
news:20040416194831.92521.qmail@pb1.pair.com...
> Is the following code the best way to redirect someone to a different
> page using PHP?
>
> <?php
> header("Location: http://www.yahoo.com");
> ?>
From personal experience I can recommend putting "exit;" behind a header()
redirect to absolutely make sure that no code is executed afterwards in the
script:
header("Location: http://www.yahoo.com"); exit;
Without "exit;" the header redirect soemtimes didn't work for me.
Regards,
Torsten Roehr
>
> I looked for a "redirect" function of some kind and didn't come up with
> anything. Just curious what the consensus is...
>
> Thanks