gzip的工作,但YSlow会提示它不是 [英] gzip working but YSlow indicates it's not

查看:218
本文介绍了gzip的工作,但YSlow会提示它不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经习惯了的萤火虫 YSlow的特别。其中一个我期待的事情是gzip的COM pression。 YSlow的仍然给我的网站的F,表示我的CSS和JavaScript文件不会被COM pressed。

I'm getting used to Firebug and YSlow in particular. One of the things I'm looking at is the gzip compression. YSlow still gives my site an "F" and indicates that my CSS and JavaScript files are not being compressed.

不过,如果我跑对我的网站外部gzip的测试(如 http://www.gidnetwork.com/tool​​s/gzip-test.php )它告诉我,GZIP是工作,给了我我的积蓄,但我认为这可能只是HTML。

However, if I run an external gzip test against my site (such as http://www.gidnetwork.com/tools/gzip-test.php) it tells me that gzip is working and gives me my savings, although I think this may just be the HTML.

这是我的的.htaccess 文件的相关部分:

This is the relevant section of my .htaccess file:

<IfModule mod_gzip.c>
    mod_gzip_on       Yes
    mod_gzip_dechunk  Yes
    mod_gzip_item_include file      \.css$
    mod_gzip_item_include file      \.(html?|txt|js|php|pl|jpg|png|gif)$
    mod_gzip_item_include handler   ^cgi-script$
    mod_gzip_item_include mime      ^text/.*
    mod_gzip_item_include mime      ^application/x-javascript.*
    mod_gzip_item_exclude mime      ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

为什么YSlow的不与外部GZIP测试同意吗?

Why does YSlow not agree with the external gzip test?

推荐答案

mod_gzip的就是Apache 1的过时的部分 X ,已通过 mod_deflate模块在Apache 2的替代。

mod_gzip is an obsolete part of Apache 1.x, having been replaced by mod_deflate in Apache 2.

mod_deflate模块配置使得YSlow的高兴在这里:

This mod_deflate configuration makes YSlow happy here:

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE text/css text/html text/plain text/xml
    DeflateCompressionLevel 9
</IfModule>

的唯一原因有两个 AddOutputFilterByType 行是为了避免水平滚动。

The only reason there are two AddOutputFilterByType lines is to avoid horizontal scrolling.

这篇关于gzip的工作,但YSlow会提示它不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆