CodeIgniter Forums
Why can't we have folders with the same name in App\Controllers and \Public? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Why can't we have folders with the same name in App\Controllers and \Public? (/showthread.php?tid=81096)



Why can't we have folders with the same name in App\Controllers and \Public? - castle - 01-24-2022

Hi,
I noticed some errors in my app, and after some struggles, I decided to rename a folder that had the same name in Controllers and Public. After that, my app worked. So, is there something I'm missing here. Because for me, the below would not work:
Code:
- app
  -- Controllers
      -- Backend
- public
      -- backend

Thanks.


RE: Why can't we have folders with the same name in App\Controllers and \Public? - kenjis - 01-24-2022

If you have a folder, your web server searches it and does not route to PHP (CodeIgniter).


RE: Why can't we have folders with the same name in App\Controllers and \Public? - castle - 01-25-2022

(01-24-2022, 07:14 PM)kenjis Wrote: If you have a folder, your web server searches it and does not route to PHP (CodeIgniter).

Thank you for the info. It would be nice to have a note about this in the documentation.


RE: Why can't we have folders with the same name in App\Controllers and \Public? - kenjis - 01-25-2022

I added a Note:
https://codeigniter4.github.io/CodeIgniter4/incoming/controllers.html#organizing-your-controllers-into-sub-directories


RE: Why can't we have folders with the same name in App\Controllers and \Public? - castle - 01-26-2022

Thank you.