I have two directories within my codeigniter controller.
/controllers/admin/
- dashboard.php
- content.php
- enquiries.php
/controllers/members/
- profile.php
- chat.php
- settings.php
Because the directory folders are not themselves controllers I can’t perform any functions if the user browses to the root of the directory.
Example if the user browses to
/localhost/admin/
a view won’t be loaded and will not show a 404. This lets users know that the directory does exist, giving me a security risk because people will know that I have an admin directory.
How is it possible to show a 404 message if the user browses to the root of the directory folder???
You could add this in config/routes.php:
$route['admin'] = 'errors/page_missing';
$route['members'] = 'errors/page_missing';
… where Errors is a controller with a method of page_missing, where you load a ‘file not found’ view.