How to prevent Apache from displaying the file list

Source: Internet
Author: User
When you enter the address http: // localhost: 8080/in the browser, if index.html is in your file directory, the browser displays the content of index.html. If no index.html exists, Apache displays the directory list of the file root directory in the browser. The Directory list includes the file root...

When you enter the address in your browser:
Http: // localhost: 8080/
If the root directory of your file contains index.html, the browser will display the content of index.html. If no index.html is available, Apache will display the directory list of the root directory of the file in the browser, the directory list includes files and subdirectories under the root directory of the file. Security risks to websites.
Similarly, when you enter a virtual directory address:
Http: // localhost: 8080/My/
If the virtual directory does not contain index.html, the browser will also display the directory structure of the virtual directory, listing the files and subdirectories under the virtual directory.
You can modify the Apache configuration file to disable Apache from displaying the directory structure list.
Open httpd. conf to see a directory configuration:


Options Indexes FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all

You only need to remove the Indexes in the red code above to disable Apache from displaying the directory structure. The user will not see the list of files and subdirectories under this directory.
Indexes is used to display the directory structure when no index.html file exists in the directory.
It is changed to the following:


Options FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all

In addition, you can add a minus sign "-" before Indexes to disable Apache from displaying the directory structure.
Adding "+" in front of Indexes indicates that directory browsing is allowed; adding "-" indicates that directory browsing is prohibited. Modify as follows:


Options-Indexes FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all




This article is from WEB developers

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.