Detailed explanation of Indexes FollowSymLinks of Options of Apache server

Suppress Apache Directory Listings -
How Indexes FollowSymLinks modifies the configuration of a directory to suppress Apache directory listings.
By default if you enter the address in the browser:

http://localhost:8080/
If there is index.html in your file root directory, the browser will display the content of index.html, if there is no index.html, the browser will display the directory list of the file root directory, the directory The list includes files and subdirectories under the file root directory.

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 will also display the directory structure of the virtual directory, listing the files and subdirectories under the virtual directory.

How to prevent Apache from displaying directory listings?

To prevent Apache from displaying a list of directory structures, simply remove Indexes from 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 just need to remove the Indexes in the above code to prevent Apache from displaying the directory structure. The user will not see the list of files and subdirectories in that directory.

The function of Indexes is to display the directory structure when there is no index.html file in the directory. If Indexes is removed, Apache will not display the list of the directory .

The second method
Solution:
        1. Edit the httpd.conf file
            vi ./conf/httpd.conf

   Find the following:
   

<Directory “C:/Program Files/Apache2.2/htdocs”>
              #
              # Possible values for the Options directive are “None”, “All”,
              # or any combination of:
                 Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
              #
              # Note that “MultiViews” must be 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 may be 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>

 Add the – symbol in front of Indexes in Options Indexes FollowSymLinks.

        Namely: Options -Indexes FollowSymLinks
   [Note: Before Indexes, + means allow directory browsing; plus – means prohibit directory browsing.

    In this case, it belongs to the entire Apache to prohibit 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 the test project is prohibited.

Note: Remember not to change "Allow from all" to "Deny from all", otherwise, the entire website cannot be opened.

There is another way:

can be entered in the .htaccess file in the root directory

<Files *>
    Options -Indexes
</Files>
prevents Apache from listing the directory structure.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324650399&siteId=291194637
Recommended