简体   繁体   中英

Routing controllers in sub folders - Codeigniter 3

I have admin folder in my controllers Folder. Structure as Below.

  • Controllers
    ----admin

    -----------Admin.php

    -----------Dashboard.php

How to set a default controller?

I am getting 404 Page Not Found

http://localhost:8080/project/admin/
$routes['admin'] = 'admin/index';
$route['folder'] = "folder/home";
$route['admin'] = 'admin/admin';

$route['admin/dashboard'] = 'admin/dashboard';
$route['admin/logout'] = 'admin/profile';
$route['admin/home'] = 'admin/home';

Not possible in CodeIgniter 3

Reference >>>

I am maintaining my admin related controller's in a directory (Controllers/admin/)

//ADMIN

//$route['folder'] = "folder/home";
$route['admin'] = 'admin/admin';

$route['admin/dashboard'] = 'admin/dashboard';
$route['admin/logout'] = 'admin/profile';
$route['admin/home'] = 'admin/home';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM