View Full Version : the php header redirect
MaryC
08-05-2005, 06:31 PM
I tested my php script with the code as follow:
header("Location: $URL");
on my localhost and it worked fine. Now that I upload my script to my FutureQuest account and run the same script with correct URL (of course) but it simply would not redirect my page. Did I do anything wrong?
hobbes
08-05-2005, 07:05 PM
What's the value of $URL? Is it enclosed in <?php ... ?> ?
MaryC
08-05-2005, 07:13 PM
My code looked like this:
<?php
$aURL="http://www.mydomain.com/aFolder/aScript.html";
/* some database connection code here */
header("Location: $aURL");
exit;
?>
hobbes
08-05-2005, 07:25 PM
Could it be that you have blank spaces before <? and/or the "some database connection code here" results in output to the browser?
Also, have you checked your php error log in ~/../logs_cgi/ ?
MaryC
08-05-2005, 07:37 PM
Thank you for your help. I did have a output to browser before heaer():
printf("some message");
mysql_close($link);
header("Location: $aURL");
but what I don't understandard is, the same script ran fine on my localhost. Is it because of the setup? again I appreciate your help. :smile:
hobbes
08-05-2005, 08:02 PM
It could possibly be config dependant, such as output being buffered on your local system and not at FQ. Check your local system's php (http?) error log; there may be some info in there.
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.