I know this has been covered before but I cannot find an answer to this,
I have always used this;
header(\"Location: http://www.website.com/\");
exit
Adding ob_start() solved this issue.
Try removing the Space Between location and the first h in http.
header("Location: http://www.website.com/");
exit();
turns into
header("Location:http://www.website.com/");
exit();
I had this problem on my WAMP Server.
Although it shouldn't be the problem, considering that is how it is documented in the PHP documentation. But you should probably try it anyway. I know it has worked for me in a number of cases.
Try:
error_reporting(E_ALL | E_WARNING | E_NOTICE);
ini_set('display_errors', TRUE);
flush();
header("Location: http://www.website.com/");
die('should have redirected by now');
See what you get. You shouldn't use ^ (xor) in your error_reporting() call because you're unintentionally asking for all errors EXCEPT notices and warnings.. which is what a 'headers already sent' error is.
Edit:
Also try putting flush() right above your header() call.
try this. worked for me.
echo "<meta http-equiv='refresh' content='0;url=http://www.yoursite.com'>";
Also when you are using the header function it has to be the first thing called before any text (even a space) is written to the client, so check again that there is no spaces being output prior to your call even before th
<?php
1) there should not be any output (i.e. echo..
or HTML codes) before the header(.......);
command.
2) there should not be a white-space(or newline) before <?php
and after ?>
tags.
3) GOLDER RULE! - the file (and other include()
-d files) should have UTF8 without BOM encoding (and not just UTF-8). That is problem in many cases (because typical UTF8 encoded file has something special character in the start of file output)!!!!!!!!!!!
4) When redirecting, after header(...);
you must use exit;
5) Recommended practice - always use 301 or 302 in reference:
header("location: http://example.com", true, 301 ); exit;
6) If none of above helps, use JAVSCRIPT redirection(but it's highly not recommended By Google), but it may be the last chance...:
echo "<script type='text/javascript'>window.top.location='http://example.com/';</script>"; exit;