首页 > 服务器维护 > apache

Apache服务器gz格式Sitemap乱码问题解

发布时间:2016-1-28 00:50

经过一天一夜的排查附上这苦逼的两行。通过”SetEnvIfNoCase Request_URI .gz$ no-gzip dont-vary”来排除任意不想压缩传输的文件。

 代码如下 复制代码

<IfModule mod_deflate.c>
 
############################################
## enable apache served files compression
## http://www.111cn.net 
# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript
 
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
 
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip
 
# MSIE masquerades as Netscape, but it is fine
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
 
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .xml$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .gz$ no-gzip dont-vary
 
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

解决中文乱码二

apache Web中文显示乱码

(1)在每一个网页里增加

 代码如下 复制代码
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">

并在APACHE的httpd.conf设置文件中将

 代码如下 复制代码

AddDefaultCharset ISO-8859-1
改为
AddDefaultCharset off

解决的方法之二:

直接在httpd.conf设置文件中将AddDefaultCharset ISO-8859-1 改为  【东莞机房 首选动力互联】

 代码如下 复制代码
 AddDefaultCharset GB2312 .ZH-CN .zh-cn

上述两种方法都能解决apache Web服务器网页显示乱码的问题

标签:[!--infotagslink--]

您可能感兴趣的文章: