2

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..

Tuxdude
  • 47,485
  • 15
  • 109
  • 110
wiitohzjeh
  • 337
  • 1
  • 4
  • 15

2 Answers2

1

I found the problem. Reading the user guide carefully, i found that i had not read well how to handle subdirectories of controllers:

Simply create folders within your application/controllers directory and place your controller classes within them.

It can not be a subdirectory of a directory, but a directory directly, like this:

application/
    controllers/
        d2/
        mc/
        cp/
        --- login.php
    ...
wiitohzjeh
  • 337
  • 1
  • 4
  • 15
0

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.

MaxQ
  • 595
  • 1
  • 8
  • 25