database is not getting autoloaded upon specific kind of 404 routing in codeigniter
which CI version you're using? try to update your CI version.
at CI 2.1.0 had fixed a bug (Reactor #19) where 1) the 404_override route was being ignored in some cases, and 2) auto-loaded libraries were not available to the 404_override controller when a controller existed but the requested method did not.
Here I found a fix for this:
https://bitbucket.org/ellislab/codeigniter-reactor/changeset/2fa0e75a2101
For preserving this answer:
replace (system/core/CodeIgniter.php) line 292 :
show_404("{$class}/{$method}");
with (system/core/CodeIgniter.php) line 292 :
// Check and see if we are using a 404 override and use it.if ( ! empty($RTR->routes['404_override'])){ $x = explode('/', $RTR->routes['404_override']); $class = $x[0]; $method = (isset($x[1]) ? $x[1] : 'index');}else{ show_404("{$class}/{$method}");}
and replace (system/core/Router.php) line 273 :
if (!empty($this->routes['404_override']))
with (system/core/Router.php) line 273 :
if ( ! empty($this->routes['404_override']))