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