Search code examples
phpcodeignitercodeigniter-routing

Controller in subfolder cant be loaded


Morning all,

Im having very troubles with controllers/uri and subfolders, the directory looks like this:

application/
     controllers/
         d2/
         mc/
             cp/
             --- login.php
     ...

The routes.php is :

$route["cp"] = "mc/cp/login/login_form";
$route["cp/login"] = "mc/cp/login/login_form";

And the login.php is :

class Login extends CI_Controller {
    public function login_form() {
        echo "hey!";
    }
}

On the logs file, i can see this:

ERROR - 10/03/2013, 09:45:00 --> 404 Page Not Found --> mc/cp 

But, when i try to enter in http://localhost/mc/cp or http://localhost/mc/cp/login returns a 404 error, where exactly is the problem? that after moving the controller to the controllers/mc folder the file load without problems..


Solution

  • This is apparently a workaround I found in an of a link in another post, although I haven't tried it.

    http://glennpratama.wordpress.com/2009/10/20/multi-level-subfolder-for-controller-in-codeigniter/

    just for info, you are allowed sub-sub directories in most other locations, in particular views,models and helpers.