How Apache Opens the Directory browsing function

Source: Internet
Author: User
Tags character set


Modified in master configuration file httpd.conf:

1) Add support module.

LoadModule Autoindex_module modules/mod_autoindex.so
LoadModule Dir_module modules/mod_dir.so

Note Be sure to have these two modules, otherwise the following configuration does not take effect, return 404 Not Found error.
This module may also be compiled directly into the Apache core file httpd.

2 Add options Indexes to the DocumentRoot directory to generate the catalog.

<directory "/htdocs" >
Options Indexes FollowSymLinks
</Directory>

Here indexes control whether to open Directory browsing, if you want to close directory browsing, use

Option-indexes

3) Load httpd-autoindex.conf configuration

Include conf/extra/httpd-autoindex.conf

Example

Add the following code to the http.conf (if there is a virtual host configuration, load into the virtual host configuration segment)


1 alias/dist "I:/build/dist"
2 <directory "I:/build/dist" >
3 #开启目录列表索引模式
4 Options Indexes
5 Order Allow,deny
6 Indexoptions namewidth=25 Charset=utf-8
7 Allow from all
8 </Directory>


where "I:/build/dist" is the directory to display a list of files, the parameter "Options Indexes" means to enable directory browsing, "Indexoptions Charset=utf-8" set the character set to eliminate Chinese garbled, namewidth=50 : Specifies that the directory list can display a file/directory name that is up to 25 bytes long.

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.