Apache2.2+mod_encoding解决URL中文编码问题




Apache2.2+mod_encoding解决URL中文编码问题


讲模块放入到modules里目录下,然后添加loadModule加载模块


LoadModule encoding_module modules/mod_encoding.so


EncodingEngine on

NormalizeUsername on

SetServerEncoding GBK

DefaultClientEncoding UTF-8 GBK GB2312

AddClientEncoding "(Microsoft .* DAV $)" UTF-8 GBK GB2312

AddClientEncoding "Microsoft .* DAV" UTF-8 GBK GB2312

AddClientEncoding "Microsoft-WebDAV*" UTF-8 GBK GB2312


最后安装库文件 

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.2 

LoadModule headers_module modules/mod_headers.so
LoadModule encoding_module modules/mod_encoding.so
< IfModule mod_headers.c>
Header add MS-Author-Via "DAV"
< /IfModule>
< IfModule mod_encoding.c>
EncodingEngine on
NormalizeUsername on
SetServerEncoding GBK
DefaultClientEncoding UTF-8 GBK GB2312
AddClientEncoding "(Microsoft .* DAV $)" UTF-8 GBK GB2312
AddClientEncoding "Microsoft .* DAV" UTF-8 GBK GB2312
AddClientEncoding "Microsoft-WebDAV*" UTF-8 GBK GB2312
< /IfModule>

你可能感兴趣的:(Microsoft,中文)