Configure Apache disable display of file list

Source: Internet
Author: User

When you enter the address in the browser:

http://localhost:8080/
If there is a index.html in your file root directory, the browser will display the contents of the index.html, if no index.html,apache will display the directory list of the file root directory in the browser, and the directory list includes files and subdirectories under the root directory of the file. Poses a security risk to the site.
Also when you enter the address of a virtual directory:
http://localhost:8080/My/
If there is no index.html in the virtual directory, the browser also displays the directory structure of the virtual directory, listing the files and subdirectories under the virtual directory.
We can prevent Apache from displaying the list of directory structures by modifying the Apache configuration file.
Open httpd.conf to see a directory configuration:

<directory "D:/wamp/www" >
Options Indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>

You just need to remove the Indexes from the red code above, and you can prevent Apache from displaying the directory structure. Users will not see the list of files and subdirectories in the directory.
The function of Indexes is to display the directory structure when there is no index.html file in the directory.
has been replaced by the following:

<directory "D:/wamp/www" >
Options FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>

Alternatively, you can also prevent Apache from displaying the directory structure by adding a minus sign "-" in front of the Indexes.
"+" in front of the indexes to allow directory browsing, plus "-" means to prevent directory browsing. Modified as follows:

<directory "D:/wamp/www" >
Options-indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.