如何查看我的网络服务器是否正在提供带压缩的内容以及将来的过期标头? YSlow仍然告诉我,即使我已将以下项目添加到.htaccess
文件中,我仍然使用纯文本发送资源并且没有“远期”过期标题:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
</IfModule>
Picture.png http://img535.imageshack.us/img535/5110/picturemt.png
它所说的需要过期标题之一是favicon.ico文件,这里是Firebug中列出的标题:
HTTP/1.1 200 OK
Date: Sun, 18 Sep 2011 00:50:03 GMT
Server: Apache
Last-Modified: Tue, 21 Dec 2010 21:47:19 GMT
Etag: "f8233-47e-497f294aba7c0"
Accept-Ranges: bytes
Content-Length: 1150
Cache-Control: max-age=0
Expires: Sun, 18 Sep 2011 00:50:03 GMT
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: image/x-icon
它需要被gzip压缩的资源之一是主index.php文件,它不发送自己的AFAIK标头。这是响应头:
HTTP/1.1 200 OK
Date: Sun, 18 Sep 2011 00:49:33 GMT
Server: Apache
X-Powered-By: PHP/5.3.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=754163feea6fab8a8d6d7f0ef6ed3c29; path=/
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
我正在尝试使用mod_deflate
,因为这是Apache 2服务器。
我做错了什么,我可以检查什么,以及如何进一步测试?
它还告诉我“有17个组件配置错误的ETag” - 不确定这意味着什么。电子标签位于标题中,对我来说看起来还不错。