codeigniter 3.0 custom 404 not found error page
You need to set in application/config/routes.php
the following route
$route['404_override'] = 'my404';
Then you need to create a new controller in your controllers directory (application/controllers/)
<?php
class My404 extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->output->set_status_header('404');
$this->load->view('err404');//loading in custom error view
}
}
And create an err404
view. Thats all!
Refer :Reserved Routes
It's not working in codeigniter 3, I overwrite the default view (application/views/errors/html/error_404.php
) and added my custom view, now show_404()
is working fine.