'unable to load your default controller on Codeigniter

This is the error that i am getting.

Please make sure the controller specified in your Routes.php file is valid.

Let me explain this. In my application i have used HMVC. In my application folder there are two folders back-modules and front-modules.in my front-modules folder there is a folder called "home" and it has controllers,modules and views.

controllers->home.php

this is my home.php

  class Home extends MX_Controller{
    public function __construct(){
    parent::__construct();
    $this->load->helper(array('form'));
  }

    public function index(){                
    $this->template->build('home');
   }
  }

and this is my routes.php

$route['default_controller'] = "home";
$route['404_override'] = '';

when i try to go to the site, it gives this error

unable to load your default controller on Codeigniter.Please make sure the controller specified in your Routes.php file is valid.

this system works fine on localhost.

Someone please help me in this matter.



Solution 1:[1]

Typically there is a one-to-one relationship between a URL string and its corresponding controller class/method. The segments in a URI normally follow this pattern:

example.com/class/function/id/

your 'default_controller' should be:

$route['default_controller'] = "home/index";

read official CodeIgniter URI Routing Documentation

Solution 2:[2]

Kindly Check .htaccess file exist or not in root place of your website.

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

Solution 3:[3]

Some times codeigniter won't find the controller.

Go to config > routers.php

and see the value of default_controller make a controller in controllers folder with the same value.

Solution 4:[4]

According to codegniter manual managing multi application

in your index.php file change

$application_folder = 'application';

to

$application_folder = 'application/home';

and make sure the controller file name starts with capital letter

controllers->Home.php

and keep Routes.php configurations

$route['default_controller'] = "home";

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 skillcoder
Solution 2 Gurpreet Singh
Solution 3 Pradeep
Solution 4 essam eg