0

Possible Duplicate:
Headers already sent by PHP

My site is http://www.seoitc.com, we are using joomla for this site, but have 1 problem when i try auto redirect to anypage that show error: Warning: Cannot modify header information - headers already sent by (). I tried change redirect to use js but cant use same status(302,303...) same as in php. Please help to fix this problem please. Thanks!

Community
  • 1
  • 1

2 Answers2

1

Any output is being sent before you call your header function. Check for any html code before your header call, even a white space or a blank line will cause that

According to PHP Manual

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

Hanky Panky
  • 46,730
  • 8
  • 72
  • 95
0

You can use ob_start() at the top of the page. to prevent error.
but also you can use this code. if any error happens in your page it will redirect you to the $page:

// page address
function redirect($page) 
{
    header("Location: ".$page);
}
set_error_handler("redirect");

And you can check this out: Headers already sent by PHP

Community
  • 1
  • 1
Siamak Motlagh
  • 5,028
  • 7
  • 41
  • 65