Hi,
I’m a newbie here with rather limited knowledge of technical matters. I’ve read every post on this forum on Cache Static Content. My URL is: http://www.LifeStrategies.net created with RapidWeaver on a Snow Leopard Mac. My test results are at http://www.webpagetest.org/result/130718_ND_781d1410aa45babf356efbebebd19823/
I’m getting AAAAF now, having compressed my header image, and Cache Static Content still rates F. see http://www.webpagetest.org/result/130718_85_132aa9ae6c04e74d6da1319e238d222c/
Over a year ago, I copied someone’s code and set my htaccess file to cache images etc using:
Set up caching on media files for 6 months. 2012/05/01
<FilesMatch “.(ico|gif|jpg|jpeg|png|flv|pdf|swf|mov|mp3|wmv|ppt)$”>
ExpiresDefault A14515200
Header append Cache-Control “public”
end caching code
So isn’t caching already enabled? Yet Cache Static Content says even my favicon .ico is not cached, which should be cached by this. Is webpagetest.org ignoring the 6 months ExpiresDefault I’ve specified? Or have I made a mistake copying this somehow? Am I getting any caching or not?
It did seem to make a difference when I put this snippet in htaccess, my pages load within a couple of seconds. Should I instead specify each type separately, perhaps go to the one year maximum, by using:
ExpiresByType image/ico A31536000
ExpiresByType image/jpg A31536000
ExpiresByType image/png A31536000
And should I add css and javascript to it, eg:
ExpiresByType text/css A31536000
ExpiresByType text/javascript A31536000
I’m wondering if this could be the cause of the problem? Google’s help page at: Leverage Browser Caching | PageSpeed Insights | Google Developers specifies:
[i]"Expires and Cache-Control: max-age. These specify the “freshness lifetime” of a resource, that is, the time period during which the browser can use the cached resource without checking to see if a new version is available from the web server. They are “strong caching headers” that apply unconditionally; that is, once they’re set and the resource is downloaded, the browser will not issue any GET requests for the resource until the expiry date or maximum age is reached.
“…Last-Modified is a “weak” caching header … It is important to specify one of Expires or Cache-Control max-age, AND one of Last-Modified or ETag, for all cacheable resources.”[/i]
So Developers.Google says I should BOTH use Expires AND to specify a date as Last Modified. But why need both? Should I specify both?
If so, where and how do I specify Last-Modified or use the “CacheIgnoreNoLastMod On” directive. Can either of these be done in htaccess, if so exactly how and where?
Thanks a million for all and any help…
Cris