Home > Article > Backend Development > Problem with entering the project subdirectory address in the url bar to list the directory?
I’m using a CI framework. How do I set up a system that prohibits access to subdirectories?
I’m using a CI framework. How do I set up a system that prohibits access to subdirectories?
nginx/Apache configuration single entry
httpd.conf
Options Indexes FollowSymLinks
Modified to:
Options FollowSymLinks
Framework independent
Maybe you don’t understand the meaning of single entrance, which is mainly to prevent unauthorized access. For example: your root directory is
index.php //Program entrance
admin //Assume it is the background file
----index.php
----left.php
----main.php
At this time There is a problem. If others know your path, they can directly access admin/index.php and see the content of the background page. How to solve this problem? Then in the root directory
<code>index.php define ("ROUTE", TRUE ); $dos = array ('index','left','main'); (!empty($do)&& in_array($do, $dos)) and $do or $do='index'; admin/index.php defined ( 'ROUTE' ) or exit ( 'Access Denied' ); 这样 但别人直接访问admin/index.php的时候就可以起到禁止访问的效果 所有访问都必须通过你的url规则来访问 </code>
Apache:
Enter the apache configuration file httpd.conf and find:
<code>Options Indexes FollowSymLinks 修改为: Options FollowSymLinks</code>
Indexes identifies the current directory and displays the directory structure without index.html