1) Modify the directory configuration:
Copy CodeThe code is as follows:
<directory "D:/apache/blog.phpha.com" >
Options Indexes FollowSymLinks # Modified to: Options FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
Just 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 role of Indexes is that when there is no index.html file in the directory, the directory structure is displayed, and the Indexes is removed, and Apache does not display a list of that directory.
2) Modify Apache configuration file [httpd.conf]
Search for "Options Indexes followsymlinks" and Change to "Options-indexes followsymlinks".
In the options Indexes followsymlinks in front of the Indexes plus – symbol. Note: Before indexes, the Plus + delegate allows directory browsing; plus – disables directory browsing. This is the entire Apache Ban directory browsing.
If you are configuring a virtual machine, the following:
Copy CodeThe code is as follows:
<virtualhost *>
<directory ". /vhosts/blog.phpha.com ">
Options-indexes FollowSymLinks # Change to-indexes
</Directory>
ServerAdmin [email protected]
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 new or modified. htaccess files in the root directory
Copy CodeThe code is as follows:
<files *>
Options-indexes
</Files>
Disable Apache from displaying directory indexes