[問題] 建議使用瀏覽器快取功能?
把做好的網站丟給google page speed測
測出來的結果,高度優先那邊顯示。
採用這些建議僅需投入極少的開發人力,但卻能大幅改善網站效能。您應該
優先處理這個項目:使用瀏覽器快取功能
他列了一些網站的圖片跟js
網站是用現成的php cms去改的
於是我在主目錄底下的.htaccess裡面加了
ExpiresActive On
ExpiresDefault "access plus 2 months"
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
在網頁header加了
<meta http-equiv="Expires" content="Tue, 09 Dec 2012 00:00:00 GMT">
然後回到google page speed看
分數是有變高了,列的那堆圖片跟js也變少了
奇怪的是,是變少,而不是完全不見,例如編號1~12的圖片
只剩編號1.3.6.10.12的圖還在改進建議裡面
請問我是有那裡設定錯了嗎? 還是還有哪裡需要設定?
網站主機就提供一個cpanel給人操控而已
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.58.177.95
推
08/18 17:55, , 1F
08/18 17:55, 1F
他顯示的是
HTTP/1.1 200 OK
Date: Thu, 18 Aug 2011 10:05:46 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
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
Content-Encoding: gzip
Set-Cookie: PHPSESSID=6571eb684369d2c49c816c92616184bb; path=/
Set-Cookie: language=tw; expires=Sat, 17-Sep-2011 10:05:46 GMT; path=/; domain=
Set-Cookie: currency=TWD; expires=Sat, 17-Sep-2011 10:05:46 GMT; path=/; domain=
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
麻煩大大解籤了~
※ 編輯: ss163500 來自: 61.58.177.95 (08/18 18:07)
→
08/18 18:27, , 2F
08/18 18:27, 2F
圖片回傳的header...是說把那些出問題的圖片網址丟進去REDbot測嗎...
HTTP/1.1 403 Forbidden
Date: Thu, 18 Aug 2011 10:49:58 GMT
Server: Apache
Content-Length: 336
Connection: close
Content-Type: text/html; charset=iso-8859-1
可是那些圖片點進去,不管是在我的電腦還是客戶電腦都是看得到的啊
js丟進去測是這樣
HTTP/1.1 200 OK
Date: Thu, 18 Aug 2011 11:06:03 GMT
Server: Apache
Accept-Ranges: bytes
Content-Length: 15624
Cache-Control: public, no-transform
Expires: Fri, 21 Dec 2100 00:00:00 GMT
Connection: close
Content-Type: application/javascript
再去page speed測一次,結果「使用瀏覽器快取功能」從高度優先變成中度優先了0.0
但是那些建議的圖片跟js還是沒變少= =
※ 編輯: ss163500 來自: 61.58.177.95 (08/18 19:07)
→
08/18 19:22, , 3F
08/18 19:22, 3F
→
08/18 19:22, , 4F
08/18 19:22, 4F
→
08/18 19:23, , 5F
08/18 19:23, 5F
→
08/18 19:36, , 6F
08/18 19:36, 6F
→
08/18 19:39, , 7F
08/18 19:39, 7F
→
08/18 19:52, , 8F
08/18 19:52, 8F