codeigniter 3.0 custom 404 not found error page

后端 未结 4 776
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-05 11:53

My problem is about custom error pages after upgrading to Codeigniter 3.0.

I used to have a Errors controller which handled 404 error page of the websi

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-05 12:23

    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/)

    output->set_status_header('404'); 
        $this->load->view('err404');//loading in custom error view
     } 
    } 
    

    And create an err404 view. Thats all!

    Refer :Reserved Routes

提交回复
热议问题