Why controller under admin subdirectory not found? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: Why controller under admin subdirectory not found? (/showthread.php?tid=88588) |
Why controller under admin subdirectory not found? - petrogromovo - 10-01-2023 In codeigniter 4.3.7 I created new controller file under subdirectory app/Controllers/admin/Category.php with defined : PHP Code: <?php But urls Code: http://localhost/CIProducts/admin/categories/index not opens my controller, as I expected and returns 404 error while url Code: http://localhost/CIProducts returns default homepage I added in file Routes.php line with "admin/" url: PHP Code: <?php How to reference controller in file app/Controllers/admin/Category.php with "admin/" in url? Thanks in advance! RE: Why controller under admin subdirectory not found? - ozornick - 10-01-2023 Try App\Controllers\admin\Category::index And use "Admin" naming for directory RE: Why controller under admin subdirectory not found? - kenjis - 10-02-2023 Read https://codeigniter4.github.io/CodeIgniter4/incoming/routing.html#controller-s-namespace and you can check your routes with `spark routes` command: https://codeigniter4.github.io/CodeIgniter4/incoming/routing.html#confirming-routes |