Apache 中文目录浏览乱码解决办法
经过测试,如果目录中含有中文文件或者中文目录的时候,在IE下显示乱码,于是在浏览器中查看其编码发 现它默认使用ISO-8859-1编码。可以在Apache配置文件中为Indexes指定特定的编码,我们能够修改配置文件让其支持中文。Apache 2默认使用ISO-8859-1或UTF-8编码。
在配置文件中添加:IndexOptions Charset=UTF-8
这样这样就能解决Apache autoindex模块中文乱码问题了。
开启:LoadModule autoindex_module modules/mod_autoindex.so
修改:httpd.conf,开启Include conf/extra/httpd-autoindex.conf
使用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