Problem with entering the project subdirectory address in the url bar to list the directory?

WBOY
Release: 2016-08-08 09:06:50
Original
1056 people have browsed it

I’m using a CI framework. How do I set up a system that prohibits access to subdirectories?

Problem with entering the project subdirectory address in the url bar to list the directory?

Reply content:

I’m using a CI framework. How do I set up a system that prohibits access to subdirectories?

Problem with entering the project subdirectory address in the url bar to list the directory?

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>
Copy after login

Apache:
Enter the apache configuration file httpd.conf and find:

<code>Options Indexes FollowSymLinks
修改为:
Options FollowSymLinks</code>
Copy after login

Indexes identifies the current directory and displays the directory structure without index.html

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!