You can create your custom 404 page with these steps. Please follow these steps one by one.

 

  • You have to update your own created controller's class with $route['404_override'] = 'Controller_Class_Name';. You have to update this in your application/config/routes.php
  • Please create your new controller "Controller_Class_Name" file in your controllers directory application/controllers/.
  • Please put this code in your Controller_Class_Name.php

    class Controller_Class_Name extends CI_Controller {
         public function __construct() {
              parent::__construct();
         }

        public function index() {
             $this->output->set_status_header('404');
             $this->load->view('error_page_404');
        }
    }
  • Now create your "error_page_404" view file.
BY Best Interview Question ON 04 Jul 2020