Re: Problem with redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks guys.
As suggested, I had previous sent an echo command.
Regards,
Bunmi

George Pitcher wrote:

Bunmi,

I haven't seen any replies, though you may have had some off-list.

Somehere in your code, you are outputting data. You cannot have any output
before a header(). Even a testing echo would have this effect.

Hope this helps..

George in Oxford


Michael Quinn wrote:

Because you have already sent output to the browser before calling the
header() function.  Maybe you have <head /> tags somewhere before your code
or something.

There is a lazy workaround below for you.

if (isset($HTTP_SERVER_VARS['HTTPS']) && ($HTTP_SERVER_VARS['HTTPS']
== "on")) {
$protocol = "https://";;
}
if (preg_match("#^/#", $url)) {
$url = $protocol.$server_name.$url;
} else if (!preg_match("#^[a-z]+://#", $url)) {
$url = $protocol.$server_name.(preg_replace("#/[^/]*$#", "/",
$HTTP_SERVER_VARS["PHP_SELF"])).$url;
}
echo "<script>location.href='" . $url . "';</script>";
}
exit;
}



Jason Barnett wrote:
Bunmi Akinmboni wrote:

I develop under windows. Why will my redirect be giving this error:

Warning: Cannot modify header information - headers already sent by
(output started at

....

Search the archives for your error message, you will find the answer.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins




--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux