WebPagetest Forums
cache static content only bad grade - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Discuss Test Results (/forumdisplay.php?fid=4)
+--- Thread: cache static content only bad grade (/showthread.php?tid=12749)



cache static content only bad grade - domabout - 01-09-2014 11:39 AM

hello,
Ran speed test and was fortunate to get all A's except for 'cache static content'. Here is results page: http://www.webpagetest.org/result/140108_BA_TRB/

I run opencart. I came across code that might help improve the cache static content grade but I usually don't like loading up .htaccess. Would this be safe to use or any other recommendations:

# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

thank you


RE: cache static content only bad grade - robzilla - 01-10-2014 08:17 PM

The .htaccess rules above affect gzip compression of text files, not caching. According to your test results, you have this enabled.

To enable caching of static files using .htaccess, however, consider adding something like this:

Code:
<FilesMatch "\.(jpg|jpeg|png|gif|js|css|ico)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>

Add or remove file extentions, and change the expiry time, as you see fit (2592000 is roughly 1 month).