Get the App
SLTechnology News&Howtos  ›  Servers  › 

Common methods of preventing apache from displaying Catalog Index

Shulou Source: shulou.com Published: 2022-06-01 10:24:28 10月06日 Update

This article mainly introduces "common methods to prohibit apache from displaying directory indexes". In daily operation, I believe many people have doubts about common methods to prohibit apache from displaying directory indexes. Xiaobian consulted all kinds of information and sorted out simple and easy to use operation methods. I hope to answer your doubts about "common methods to prohibit apache from displaying directory indexes". Next, please follow the small series to learn together!

To disable Apache from displaying directory indexes, simply remove Indexes http://www.bbqmw.net/qm_yeqm/from Option.

1)Modify directory configuration:

The copy code is as follows:

Options Indexes FollowSymLinks #modified to: Options FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

Simply remove the Indexes from the above code to disable Apache from displaying the directory structure. Users 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. Remove Indexes and Apache will not display the list of directories.

2)Modify Apache configuration file [httpd.conf]

Search for "Options Indexes FollowSymLinks" and modify it to "Options -Indexes FollowSymLinks".

In Options Indexes FollowSymLinks put a-sign in front of Indexes. Note: Before Indexes, add + to allow directory browsing; add-to prohibit directory browsing. In this case, it belongs to the entire Apache forbidden directory.

If you are configuring a virtual machine, it is as follows:

The copy code is as follows:

Options -Indexes FollowSymLinks #can be modified to-Indexes

ServerAdmin mail@jb51.com

DocumentRoot "../ vhosts/blog.phpha.com"

ServerName shopex:80

ServerAlias blog.phpha.com

ErrorLog logs/blog.phpha.com-error_log

3)via.htaccess file

can be added to the root directory in the new or modified.htaccess file

The copy code is as follows:

Options -Indexes

You can disable Apache from displaying the directory index.

At this point, the study of "common ways to prohibit apache from displaying directory indexes" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Tags: Directory code index method file common learning browsing configuration representative more structure help utility and then in this case function just remarks subitems Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Technology Xiaomi OPPO Reno Linux