Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter controller in subfolder

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";

like image 608
Don P Avatar asked Jan 13 '23 18:01

Don P


1 Answers

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";
like image 126
Jakub Avatar answered Jan 21 '23 09:01

Jakub