Page 1 of 1

Redirect not working

Posted: Wed Jul 11, 2007 1:28 am
by Jhorra
I have a page that redirects at the end. For some reason on this single page it doesn't redirect. I've tried a hundred different things, it just goes to a blank page. If you look at the source code for the page it's completely blank. If I echo out the location of the redirect right before the line that redirects, it shows correctly. Also, it seems that it was working yesterday, and as far as I know there have been no changes to the page since then.

Posted: Wed Jul 11, 2007 1:39 am
by Jhorra
Additional info:

The way it currently works is this:

The end of the page shows this: show_screen($location);

This is that function:

Code: Select all

function show_screen($loc){
Header("Location: $loc");
exit;
}
I echo out the $location before it calls the function, and it works fine. I echo $loc inside the function and it's blank. If I bypass the function completely and just put in a header("Location: url.php") it doesn't redirect.

Posted: Wed Jul 11, 2007 1:49 am
by tapas_bahirbag
You can try this:

Code: Select all

function show_screen($loc){
ob_end_flush();
Header("Location: $loc");
exit;
}
--
Tapos Pal

Posted: Wed Jul 11, 2007 2:56 am
by Gente
Check if headers are sent.

Posted: Wed Jul 11, 2007 6:42 am
by Rovas
Gente wrote:Check if headers are sent.
Or are enabled by the hosting company also if that are any changes to the location of the file or typo on your part.