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