Apache2.2+mod_encoding解決URL中文編碼問題web
講模塊放入到modules裏目錄下,而後添加loadModule加載模塊apache
LoadModule encoding_module modules/mod_encoding.soide
EncodingEngine onui
NormalizeUsername on編碼
SetServerEncoding GBKspa
DefaultClientEncoding UTF-8 GBK GB2312orm
AddClientEncoding "(Microsoft .* DAV $)" UTF-8 GBK GB2312get
AddClientEncoding "Microsoft .* DAV" UTF-8 GBK GB2312it
AddClientEncoding "Microsoft-WebDAV*" UTF-8 GBK GB2312class
最後安裝庫文件
wget http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
install iconv-hook
# cd mod_encoding-20021209/lib
# ./configure --prefix=/usr
# make
# make install
# ldconfig
1.download & patch:
# wget http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
# wget http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
新版本mod_encoding.c 覆蓋
# cp mod_encoding.c.apache2.20040616 mod_encoding-20021209/mod_encoding.c
這裏必需要打一個apache 2.2的補丁。不然make也會出apxs rc=65536 之類的錯誤。
# wget http://www.aconus.com/~oyaji/faq/mod_encoding.c-apache2.2-20060520.patch
# cd mod_encoding-20021209
# patch -p0 < mod_encoding.c-apache2.2-20060520.patch
2.install iconv-hook
# cd mod_encoding-20021209/lib
# ./configure --prefix=/usr
# make
# make install
# ldconfig
3 build mod_encoding
./configure --with-apxs=/opt/apache2.2/bin/apxs --with-iconv-hook=/usr/include
make
gcc -shared -o mod_encoding.so mod_encoding.o -Wc,-Wall -Llib -liconv_hook
cp mod_encoding.so /opt/apache2.2/modules
4. config apache 2.2LoadModule headers_module modules/mod_headers.soLoadModule encoding_module modules/mod_encoding.so< IfModule mod_headers.c>Header add MS-Author-Via "DAV"< /IfModule>< IfModule mod_encoding.c>EncodingEngine onNormalizeUsername onSetServerEncoding GBKDefaultClientEncoding UTF-8 GBK GB2312AddClientEncoding "(Microsoft .* DAV $)" UTF-8 GBK GB2312AddClientEncoding "Microsoft .* DAV" UTF-8 GBK GB2312AddClientEncoding "Microsoft-WebDAV*" UTF-8 GBK GB2312< /IfModule>