Problems with Codeigniter HMVC subfolders
I have encountered an issue using subfolders with Codeigniter + HMVC.
/system/application/modules/welcome/controllers/staff/w开发者_StackOverflow社区elcome.php
To access this I have to access it via http://www.app.com/welcome/staff/welcome
Unfortunately this doesn't fit the rest of my URL structure.
How can I remove the first welcome from the URL so the URL is http://www.app.com/staff/welcome
I have tried adding a route within the module:
/system/application/modules/welcome/config/routes.php
like:
$route['staff/welcome'] = "welcome/staff/welcome";
but unfortunately no luck.
Adding this route to the real codeigniter route file works but I feel that adding code external of the modules to get modules to work misses the point of adopting modularisation.
I hope someone is able to help.
Thanks,
Tim
This line in your routes.php is correct:
$route['staff/welcome'] = "welcome/staff/welcome";
You can try to play with the order of your routing rules, and to put the rule for the default controller ($route['default_controller'] = "home";) at the end. I have project with 4 modules and it works fine for me.
精彩评论