Custom 404. Cannot modify header information. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Custom 404. Cannot modify header information. (/showthread.php?tid=61587) |
Custom 404. Cannot modify header information. - eci35 - 04-28-2015 I'm using CodeIgniter 3.0.0 and trying to setup the custom 404 error pages. When I try to follow instructions online, the page works but I get a "Cannot modify header information" error that I can't figure out how to get rid of. How do I get rid of the error? I know that I can simply get rid of the PHP Code: $this->output->set_status_header('404'); application\config\routes.php: PHP Code: $route['404_override'] = 'Errors/error_404_custom'; application\controllers\Errors.php: PHP Code: <?php application\views\errors\error_404_custom.php PHP Code: <?php Error message: Code: A PHP Error was encountered References:
RE: Custom 404. Cannot modify header information. - mwhitney - 04-29-2015 Your error message shows two different line numbers for /application/controllers/Errors.php and implies that $this->output->set_status_header('404') is on line 25. It's not clear what is being referred to as line 33 in the error message. RE: Custom 404. Cannot modify header information. - eci35 - 04-29-2015 Thank you for pointing that out. That's so weird. Line 33 refers to the closing php tag: PHP Code: ?> I deleted that line and the error goes away. So this is probably a silly question, but why would we not require that closing php tag? |