我已经习惯了的萤火虫和 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/tools/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.