This question already has an answer here:
How to fix “Headers already sent” error in PHP
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> ';
Why I'm getting "cannot modify header information headers already sent by registration_model" error in codeigniter?