Query string vanishes on header("Location: ...") redirect
| From: | Richard S. Crawford | Date: | Mon, 12 Jan 2009 22:32:57 +0000 |
| Subject: | Query string vanishes on header("Location: ...") redirect | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-286185@lists.php.net to get a copy of this message | ||
I'm trying to redirect my users to a URL which includes a query string:
$the_url =
$CFG->wwwroot."/DLC/includes/L1_accept_required.php?cid=".$course->id;
//die ("URL = $the_url");
header('Location: '. $the_url);
When I uncomment the die() command, the URL shows properly, e.g.:
http://mysite.com/DLC/includes/L1_accept_required.php?cid=152
The script at the URL calls the variable cid with $_GET:
$cid = $_GET['cid'];
When I browse directly to the URL as echoed by the die() command, the
value of cid is available to the script. However, when I do the
redirect, the URL that shows up in the browser's location bar does not
contain the query string. Thus, the script at L1_accept_required does
not function properly.
The annoying thing is that the redirect works properly everywhere else
in the site.
Can anyone give me insight into what might be going on? I've checked
for rogue .htaccess files which might be doing some fancy URL
rewriting, but found nothing.
--
Richard S. Crawford (rscrawford@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)