Re: header("Location: page.php") not redirecting
| From: | Chris Shiflett | Date: | Mon, 01 Dec 2003 21:48:21 +0000 |
| Subject: | Re: header("Location: page.php") not redirecting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171502@lists.php.net to get a copy of this message | ||
--- 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 Handbook
Coming mid-2004
HTTP Developer's Handbook
http://httphandbook.org/