A common way to disable apache from displaying directory indexes is to disable column directories with of apache

  • 2020-05-07 20:48:35
  • OfStack

Apache is not allowed to display the directory index, Apache is not allowed to display the directory structure list, Apache is not allowed to browse the directory, this is more online questions, in fact, are 1 meaning. Here are three common ways that Apache is not allowed to display directory indexes.
To disable Apache from displaying directory indexes, simply remove Indexes from Option.

1) modify directory configuration:


<Directory "D:/Apache/blog.phpha.com">
Options Indexes FollowSymLinks #  Modified to : Options  FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Simply remove Indexes from the above code to disable Apache from displaying the directory structure. The user will not see the list of files and subdirectories in that directory. Indexes is used to display the directory structure when there is no index.html file in the directory. Without Indexes, Apache will not display the list of the directory.

2) modify the Apache configuration file [httpd.conf]

Search for "Options Indexes FollowSymLinks" and change to "Options-Indexes FollowSymLinks".
Before Options Indexes FollowSymLinks add the wok symbol to Indexes. Note: before Indexes, + means to allow directory browsing; Add - and - wok to disable directory browsing. In this case, the entire Apache directory is not allowed to browse.
If the virtual machine is configured, the following is used:


<VirtualHost *>
    <Directory "../vhosts/blog.phpha.com">
        Options -Indexes FollowSymLinks #  Modified to  -Indexes  Can be 
    </Directory>
    ServerAdmin mail@jb51.com
    DocumentRoot "../vhosts/blog.phpha.com"
    ServerName shopex:80
    ServerAlias blog.phpha.com
    ErrorLog logs/blog.phpha.com-error_log
</VirtualHost>

3) through the.htaccess file

You can add to the.htaccess file in the root directory by creating or modifying it


<Files *>
 Options -Indexes
</Files>

You can disable Apache from displaying directory indexes.


Related articles: