Codeigniter: headers already sent error [duplicate]
I would check that you have no closing PHP tag in any of your models, controllers or libraries - this will often cause this type of error.
//Your Code is for redirect redirect('site/function1'); //Alternate Code for solve this issue $url = 'site/function1'; echo' <script> window.location.href = "'.base_url().'index.php?/'.$url.'"; </script> ';