0
votes

I have created controller file in subfolder of controllers on CodeIgniter 3.1. and I want to use route but I am unable to do that because of error 404 not found, my folder structure is:

  • Application
    • controllers
      • Admin (directory inside controller folder)
        • dashboard.php (controller file inside controllers/Admin/)

For route.php I am using:

route['getUsersInfo'] = "Admin/dashboard/getUsers"; (directory inside controller/ controller name /method name)
1
Set the base url of the site to sitename.com/admin. and use route[]=controler/method - Vickel
Do you have any other controllers outside Admin folder? - Muhammed Shihabudeen Labba A
@user_2 I think you need to rename your controller to Dashboard.php, since CI 3 is case sensitive, and it is expecting Ucfirst. - Muhammed Shihabudeen Labba A

1 Answers

0
votes

You should've posted the code of your controller. However I'm pretty sure CopdeIgniter is not able to find the method because the controller file is not capitalized.

So the solution is, instead of dashboard.php, rename the file to Dashboard.php. Make sure the same applies within the file, it should read like this

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Dashboard extends MY_Controller{

 public function __construct()
 {
  parent::__construct();
  # load your models here
  # $this->load->model('dashboard_model');
 }

 # your methods go here
}