Search code examples
codeigniterhmvc

How to use seaparate controllers in folder modules on codeigniter HMVC?


CI HMVC tree defaults:

modules/
..login/controllers/Login.php
..home/controllers/Home.php

i want to create this tree

modules/
..frontend/login/controllers/Login.php
..frontend/home/controllers/Home.php
..backend/table/controllers/Table.php
..backend/password/controllers/Password.php

But when i try to call http://domain/frontend/login : this give me 401 error result.

How to do this?


Solution

  • the way to do this is

    modules/
    ..frontend/controllers/login/Login.php
    ..frontend/controllers/home/Home.php
    ..backend/controllers/table/Table.php
    ..backend/controllers/password/Password.php
    

    but be aware - if you want to access to login you need to call the folder and the controller even if they have the same name e.g. http://ci.dev/backend/login/login/