0

Ok, my question is...

Why is it that when i uploaded my files to the server the

header("Location:".$config_basedir.");

wont execute more than once....

But on my Localhost I had no problem with the header refreshing...


Is there a way to stop this from happening or maybe a revise PHP code I can use to let it use header feature????


Thanks in advance for the help.

-Programmer12

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ofus
0

You can use Javascript inside a php function to control your redirects.

<?php

    redirect("www.redirecting.com/page.php"); 

    function redirect($url)
    {
?>
        <script type="text/javascript">
		window.location = "<?php echo $url ?>"
        </script>
<?php
    }
?>

Edited by nonshatter: n/a

0

I bet your script has sent some kind of output before it reaches your header command on the server (probably a warning or error message). Try this:

// If no headers are sent, send one
if (!headers_sent()) {
    header("Location: $config_basedir");
    exit;
} else {
    echo "<pre>Error: Cannot redirect, headers have already been sent.\n";
    var_dump(headers_list());
    die;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.