Configuring Apache to disable the display of file lists

  
                  

When you enter the address in your browser: http://localhost:8080/If you have index.html in the root of your file, the browser will display the contents of index.html. If there is no index.html, Apache will The browser displays a list of directories in the root directory of the file, including the files and subdirectories under the root of the file. A security risk to the website. Similarly, when you enter the address of a virtual directory: http://localhost:8080/My/If there is no index.html under the virtual directory, the browser will also display the directory structure of the virtual directory, listing the files under the virtual directory. And subdirectories. We can disable Apache from displaying a list of directory structures by modifying the Apache configuration file. Open httpd.conf and look at a directory configuration:
<Directory "D:/WAMP/WWW"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all</Directory>

You only need By removing the Indexes from the red code above, you can disable Apache from displaying the directory structure. Users will not see the list of files and subdirectories under this directory. The role of Indexes is to display the directory structure when there is no index.html file in the directory. Now change to the following:
<Directory "D:/WAMP/WWW"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all</Directory>

Alternatively, you can add a minus sign before Indexes “-”, can also prohibit Apache from displaying the directory structure. Adding “+” before Indexes means allowing directory browsing; adding “-” means prohibiting directory browsing. Amend as follows:
<Directory "D:/WAMP/WWW"> Options -Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all</Directory>

Copyright © Windows knowledge All Rights Reserved