Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a controller in a subfolder. CodeIgniter is giving a 404 page not found.

The controller works fine in the root controller folder. The controller also works fine in the 1st level subfolder. The controller breaks in the 2nd level subfolder.

Why would CodeIgniter not want you to user multiple subfolders?

Example:

Works: controllers/pages/HomeController.php

Broken: controllers/pages/users/HomeController.php

My Routes are like this:

Works: $route['default_controller'] = "pages/HomeController";

Broken: $route['default_controller'] = "pages/users/HomeController";

share|improve this question
 
Found this post: stackoverflow.com/questions/13240111/… Seems dumb that CI only lets you go 1 level down. –  Donny P Jul 30 at 16:08

1 Answer

I wrote about this before, you just need to read the CI manual, but here is a quick blog entry I did which should get you back on track:

http://blog.biernacki.ca/2011/12/codeigniter-uri-routing-issue-with-controller-folders/

Example:

$route['account/manage/(:num)/(:any)']  = "account/manage/index/$1/$2";
share|improve this answer
 
I read your post, and I'm not clear what you are naming your actual controller object. Is it "Manage"? And then in Manage you just manually reroute to the controller you want? –  Donny P Jul 30 at 16:13
 
And why does CI not allow multiple level subfolders? –  Donny P Jul 30 at 16:15
 
controller is called manage it is right there in the post...? there is nothing that it 'doesn't allow' it just needs to be routed properly as the default is controller/method/values, the example above is folder/controller/method(index)/value/value (right hand side) –  Jakub Jul 30 at 17:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.