Cache, best practice ?
Hello
I've been testing different cache settings and what to share my experience. They might be useful - and there might be some of you that have different experiences, pls share.
First of all it seems to me that most cache plugins creates unintended problems and in some cases even slow down page-loading. Secondly it is my experience that good results (like 10+ in Google page speed test) can be achieved by a rather basic approach: Add the following
at the top of the .htaccess file, it should be self-explaining (the first element, mod_deflate, is hosting server dependent so it might not work if the module is not running/activated).
# DEFLATE JAVA etc
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</IfModule>
# END DEFLATE JAVA etc
# Cache 2 weeks for most static content
<filesMatch ".(jpg|jpeg|png|gif|ico)$">
Header set Cache-Control "max-age=1209600, public"
</filesMatch>
# Cache 1 week for css
js
<filesMatch ".(css|
js)$">
Header set Cache-Control "max-age=604800, private"
</filesMatch>
# Cache 2 min html htm xml php
<filesMatch ".(html|htm|xml|php)$">
Header set Cache-Control "max-age=120, private, must-revalidate"
</filesMatch>
# END Cache