CodeIgniter 2.x 404 error routing
Does the new 404 error functionality in CodeIgniter 2.x actually send a 404 error to the server so it can be tracked by analytics? Or do I need to do something in my controller? A little further digging and I found the answer at the bottom of this page:
http://codeigniter.com/forums/viewthread/开发者_运维问答164957/#790005
If you're talking about the $route['404_override']
page, it does not send a proper 404 status code by itself. I recently filed a bug report about this.
The fix in the forum post seems perfect, just making sure you set the header manually via $this->output->set_status_header('404');
in whichever method you define as the default 404. The only problem I can think of is if you want 404's to load your home page or something.
There is another issue with this as well, valid controllers with invalid methods will show the default error page instead of the custom one. You can see some reports of this on the issue tracker.
Hopefully they will correct this in future releases, and make setting the header automatic.
精彩评论