Apache Index目录中文乱码解决方法

来源地址: http://httpd.apache.org/docs/2.0/mod/mod_autoindex.html

IndexOptions Directive
Description: Various configuration settings for directory indexing 
Syntax: IndexOptions [+|-]option [[+|-]option] ... 
Context: server config, virtual host, directory, .htaccess 
Override: Indexes 
Status: Base 
Module: mod_autoindex 

The IndexOptions directive specifies the behavior of the directory indexing. Option can be one of

Charset=character-set (Apache 2.0.61 and later)
The Charset keyword allows you to specify the character set of the generated page. The default is either ISO-8859-1 or UTF-8, depending on whether the underlying file system is unicode or not. 
Example:
IndexOptions Charset=UTF-8


Apache 2默认使用ISO-8859-1或UTF-8编码。上传的文档目录和文件名称则使用了GBK编码字符,导致每次需要手工选择编码之后,才能正确显示其列出 的目录和文件名列表。为了设置以GBK编码显示目录和文件名列表,可以在Apache 2中设置上述选项:

IndexOptions Charset=GBK

在httpd.conf中加入,重启httpd服务

IndexOptions Charset=UTF-8

 

你可能感兴趣的:(Linux)