Re: header("Location: page.php") not redirecting
| From: | rogue | Date: | Mon, 01 Dec 2003 22:06:48 +0000 |
| Subject: | Re: header("Location: page.php") not redirecting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171507@lists.php.net to get a copy of this message | ||
Okay. I reworked the code a bit, but still no go.
Here is what I have:
$redirect = "http://" . $_SERVER['HTTP_HOST'] . "/cm/clients/viewclient.php?id={$_REQUEST['id']}&foo=bar";
error_reporting(E_ALL);
echo "Location: $redirect";
header("Location: $redirect");
I get NO errors at all :(
It was my understanding that the only thing I needed to worry about breaking this, would be if there was some output before the header(). There is not, but there are some variables getting set etc.
Anyone else think of anything?
Thanks
On Dec 1, 2003, at 4:48 PM, Chris Shiflett wrote:
--- rogue <rogue@mail.rightcode.net> wrote:$redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar"; header("Location: $redirect"); Only, nothing happens when this code is executed.I would try two things, in this order: 1. Use a full URL. A Location header is defined in the specification as taking a full URL as an argument. You are using a relative one, which is incorrect. 2. Replace your header call with an echo. Basically, rather than header("Location: $redirect") use echo "Location: $redirect" instead. This might reveal typos or other problems that are more difficult to inspect when in the HTTP headers instead of the content. Hope that helps. Chris ===== Chris Shiflett - http://shiflett.org/ PHP Security HandbookComing mid-2004HTTP Developer's Handbookhttp://httphandbook.org/