Redirecting via headers is illegal if any w3coded redirects re content has come through. Take out all the echos w3coded redirects re and it should work. If you do want there to be a w3coded redirects re message shown to the user before the redirect, w3coded redirects re you'll likely have to do it with JavaScript via w3coded redirects re location.href., w3coded redirects re Stack Overflow for Teams w3coded redirects re Where developers & w3coded redirects re technologists share private knowledge with w3coded redirects re coworkers w3coded redirects re ,I don't know if it matters but they are w3coded redirects re using "cpanel" which is where I can access the w3coded redirects re files and there all in the same directory so if w3coded redirects re someone could tell me where I am going wrong or w3coded redirects re suggest an alternative to redirecting via w3coded redirects re "header" any help would be greatly appreciated. w3coded redirects re I've looked around but it seems that "header" is w3coded redirects re the standard work horse., w3coded redirects re w3coded redirects re You can't have the w3coded redirects re page output anything before the header call. w3coded redirects re Your debugging statements are preventing the w3coded redirects re redirection from working. w3coded redirects re – JJJ w3coded redirects re Dec 31 '11 at 17:25 w3coded redirects re
Which works in all situations..even if headers are already sent..or even javascript is disabled..
function redirect($url)
{
if (!headers_sent())
{
header('Location: '.$url);
exit;
}
else
{
echo '<script type="text/javascript">';
echo 'window.location.href="'.$url.'";';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
echo '</noscript>'; exit;
}
}
By using the below code we redirect the page
$page = $_SERVER['REQUEST_URI'];
echo '<script type="text/javascript">';
echo 'window.location.href="'.$page.'";';
echo '</script>';
echo "<script>window.location.href='yourPage.php'</script>";
To find the place where unwanted output is generated canbe hard on bigger projects or long lines of classes extending each other. To find the problem you can do this:
error_reporting(E_ALL);
ini_set("display_errors", 1);
header("Location: https://mydomain.com/myLoginAdress/");
die();
Use This Code
Syntax :
echo '<script type="text/javascript"> window.location="<Your_URL>";</script>';
write this line insted of header("location: UI.php");
echo '<script type="text/javascript"> window.location="UI.php";</script>';
Last Update : 2023-09-22 UTC 13:06:21 PM
Last Update : 2023-09-22 UTC 13:06:10 PM
Last Update : 2023-09-22 UTC 13:05:55 PM
Last Update : 2023-09-22 UTC 13:05:42 PM
Last Update : 2023-09-22 UTC 13:05:34 PM
Last Update : 2023-09-22 UTC 13:04:55 PM
Last Update : 2023-09-22 UTC 13:04:47 PM