Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6542313
  • 博文数量: 1159
  • 博客积分: 12444
  • 博客等级: 上将
  • 技术积分: 12570
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-13 21:34
文章分类

全部博文(1159)

文章存档

2016年(126)

2015年(350)

2014年(56)

2013年(91)

2012年(182)

2011年(193)

2010年(138)

2009年(23)

分类: LINUX

2010-10-11 20:35:18

http://www.cnitblog.com/201/archive/2010/04/14/65277.html

最近打算建立一个分享资源的网络空间,想使用FTP,但是又觉得不算好用。于是就直接使用Apache的Indexes参数来搭建一个可浏览目录的虚拟主 机,好处在于可以直接在浏览器中以网页形式展现。

      但是按照Apache的文档来配置就出现问题了。经过测试,如果目录中含有中文文件或者中文目录的时候,在IE下显示乱码,于是在浏览器中查看其编码发 现它默认使用ISO-8859-1编码,手动选择GB2312后就能正常显示。看来是Apache Indexes在处理中文的时候的编码不正确。

      仔细研究其说明文档,其中介绍,可以在Apache配置文件中为Indexes指定特定的编码,我们能够修改配置文件让其支持中文。具体办法如下:

      在配置文件中添加:

     IndexOptions Charset=GB2312

    这样这样就能解决Apache autoindex模块中文乱码问题了。


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Apache 2下如何设置文件目录列表的编码

来源地址:

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


++++++++++++++++++++++++++++++++++++++++++++++++++++++

http://blog.csdn.net/jom_ch/archive/2008/06/25/2585509.aspx

使用IndexOptions FancyIndexing选项,

当访问没有DirectoryIndex指定文档的目录时,启用该选项可以针对目录下不同类型的文档指定相对应的icon

示例如下:

编辑httpd.conf,把下列代码放于任意位置:

IndexOptions FancyIndexing AddIcon /other/icons/exe.gif .bin .exe AddIcon /other/icons/dir.gif ^^DIRECTORY^^ AddIcon /other/icons/txt.gif .txt .php .PHP AddIcon /other/icons/html.gif .htm .html AddIcon /other/icons/image.gif .gif .jpg .bmp .png

重启apache



阅读(3278) | 评论(0) | 转发(1) |
0

上一篇:c语言中的 顺序点

下一篇:信号屏蔽函数

给主人留下些什么吧!~~