wordpress 页面gzip(不用插件)

  • 内容
  • 评论
  • 相关

利用.htaccess启动Gzip网页压缩

此方法是通过Apache的Enabling Compression,在你服务器站点的根目录下将.htaccess文件下载回来,要是没有就vim创建一个.htaccess文件中写入,然后储存上传。

<IfModule mod_deflate.c>

# Insert filters

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

AddOutputFilterByType DEFLATE application/x-httpd-php

AddOutputFilterByType DEFLATE application/x-httpd-fastphp

AddOutputFilterByType DEFLATE image/svg+xml

# Drop problematic browsers

BrowserMatch ^Mozilla/4 gzip-only-text/html

BrowserMatch ^Mozilla/4\.0[678] no-gzip

BrowserMatch \bMSI[E]!no-gzip !gzip-only-text/html

# Make sure proxies don‘t deliver the wrong content

Header append Vary User-Agent env=!dont-vary

</IfModule>

测试是否开启gzip压缩的站点

http://tool.chinaz.com/Gzips/Default.aspx

http://gzip.zzbaike.com/

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注

来来来,看看你是不是一个人。 *

Title - Artist
0:00