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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值