naeplus
naeplus

Reputation: 121

Controllers sub-folders inside sub-folders and routes

In Codeignitor application

Controllers/folder/sub-folder/sub-folder/my_controller.php

if i would like to access my_controller.php i can't do this. for that i am sure i need change routes.php file to do this.

$route['default_controller'] = "folder";
$route['folder/sub-folder/sub-folder'] = "folder/sub-folder/sub-folder/my_controller";

but is showing 404 error.

so my question is simple in controller folder how someone can use folder inside folders.
like this:

Controllers/folder/sub-folder/sub-folder/my_controller.php

and what is needed to do with routes.php, so i will not get 404 error.

Upvotes: 0

Views: 1197

Answers (1)

dasper
dasper

Reputation: 722

I believe there is a link in the official forms talking about this. If I remember correctly CI 1.7 did not even support sub directories and was included recently and I think they still consider it a bug.

http://codeigniter.com/forums/viewthread/190563/

If you only have a few sub directories you can also put rules in your URI routing

http://codeigniter.com/user_guide/general/routing.html

Either will be acceptable so you can choose which one will help you the most or which will get done the fastest. The other option is looking into why you need so many directories, especially for the controllers because that will make your urls longer which could ding you on SEO and other factors.

Upvotes: 1

Related Questions