Codeigniter controller not found 404 : There can be following possible reasons –
1 When your file name and class name does not match.
2 When Controller path is incorrect.
3 When incorrect routing.
1. When Class name and file name not matching.
Suppose you have a controller file named as “User.php” and your class is something different then it will not work.
example :
File name : “User.php”
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Users extends CI_Controller { } ??>
It will not work because your class name is “Users” instead of “User”
Correct Class name :
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class User extends CI_Controller { } ??>
This Will Work perfectly.
2. When controller path is incorrect.
Check your controller path where it is placed.
If you are using subfolders for example your controller is inside the “application/controllers/yourfolder/yourcontroller”
check that you are accessing correct path.
3. If Routing is done and routing is incorrect.
check your “application/config/routs.php” make sure your have written proper routing for controller and accessing the controller as defined in routs.