Disable display of Apache directory list-indexes followsymlinks
How to modify the configuration of a directory to suppress the list of Apache directories.
By default if you enter the address in the browser:
http://localhost:8080/
If you have index.html in the root directory of your file, the browser will display the contents of index.html, and if there is no index.html, the browser will display a directory listing of the root directory of the file, including the files and subdirectories under the root directory of the file.
Likewise you enter the address of a virtual directory:
http://localhost:8080/b/
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 that virtual directory.
How do I disable Apache from displaying directory listings?
To prevent Apache from displaying a list of directory structures, simply remove the Indexes in Option.
For example, let's look at the directory configuration of a directory:
<directory "D:/apa/blabla" >
Options Indexes followsymlinks #---------->options followsymlinks
allowoverride None
Order Allow,deny
allow from all
</Directory>
You only need to remove the Indexes from the above code to prevent Apache from displaying the directory structure. The user will not see a list of files and subdirectories under that directory.
The function of Indexes is that when there is no index.html file in the directory, the directory structure is displayed, and the list of the directory is not displayed if Indexes,apache is removed.
The second method of
Workaround:
1. Edit the httpd.conf file
Vi./conf/httpd.conf
Find the following:
?br> <directory "C:/Program Files/apache2.2/htdocs" >
#
# Possible values for the Options directive is "None", "all",
# or any combination of:
Indexes includes followsymlinks symlinksifownermatch execcgi multiviews
#
# Note that "MultiViews" must is named *explicitly*-"Options All"
# doesn ' t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride Controls What directives is placed in. htaccess files.
# It can be ' all ', ' None ', or any combination of the keywords:
#Options FileInfo authconfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this Server.
#
Order allow,deny
allow from all
</Directory>
...
in the options Indexes followsymlinks in front of the Indexes plus – symbol.
namely: options-indexes followsymlinks
Note: Before indexes, add + represents allow directory browsing, plus – disables directory browsing. 】
This is the entire Apache ban directory browsing.
If it is in a virtual host, just add the following information:
<directory "D:test" >
Options-indexes FollowSymLinks
AllowOverride None
Order Deny,allow
Allow from all
</Directory>
In this case, directory browsing under test engineering is prohibited.
Note: Remember not to change "allow from all" to "Deny from all", otherwise the entire Web site can not be opened.
<Finished>
There is another way:
Can be entered in the. htaccess file of the root directory
<files *>
Options-indexes
</Files>
You can prevent Apache from listing the directory structure.
Apache Options Indexes FollowSymLinks Detailed