网站采取的是apache+tomcat伪静态的方式,tomcat的server.conf里面已经设置
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8" />
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8" />
在apache设置
AddDefaultCharset off
AddDefaultCharset utf-8
在apache均出现乱码,
因此,Apache和Tomcat集成后,要使服务器支持UTF-8的中文地址,应该设置8009端口的<connector>标签
最后的方法在tomcat的server.conf里面设置apache和tomcat的连接为utf-8
设置如下:红色字体
<Connector port="8009" URIEncoding="UTF-8" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />