Common way to prevent Apache from displaying directory indexes (Apache Forbidden column directory) _linux

Source: Internet
Author: User

Prohibit Apache display directory index, prohibit Apache display directory structure list, prohibit Apache Browse directory, this is more online questioning, in fact, is a meaning. Here's a list of 3 common ways to prevent Apache from displaying directory indexes.
To prevent Apache from displaying directory indexes, simply remove the Indexes from Option.

1) Modify the directory configuration:

Copy Code code as follows:

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

You can prevent Apache from displaying the directory structure simply by removing the Indexes from the above code. Users will not see the list of files and subdirectories in the directory. Indexes is the role of the directory when there is no index.html file, the directory structure, remove the Indexes, Apache will not display the list of the directory.

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

Search "Options Indexes followsymlinks", modified to "options-indexes followsymlinks" can be.
In the options Indexes followsymlinks the front of the Indexes plus-symbol. Note: Before indexes, plus + represents permission for directory browsing, plus-represents a ban on directory browsing. This would be the whole Apache block directory browsing.
If you are configuring a virtual machine, the following are:

Copy Code code as follows:

<virtualhost *>
<directory ". /vhosts/blog.phpha.com ">
Options-indexes FollowSymLinks # modified to-indexes
</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) Adoption of the. htaccess file

You can add a new or modified. htaccess file in the root directory

Copy Code code as follows:

<files *>
Options-indexes
</Files>

You can prevent Apache from displaying directory indexes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.