htaccess site caching


/ Published in: Apache
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # 1 YEAR
  2. <FilesMatch "\.(ico|pdf|flv)$">
  3. Header set Cache-Control "max-age=29030400, public"
  4. </FilesMatch>
  5. # 1 WEEK
  6. <FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
  7. Header set Cache-Control "max-age=604800, public"
  8. </FilesMatch>
  9. # 2 DAYS
  10. <FilesMatch "\.(xml|txt|css|js)$">
  11. Header set Cache-Control "max-age=172800, proxy-revalidate"
  12. </FilesMatch>
  13. # 1 MIN
  14. <FilesMatch "\.(html|htm|php)$">
  15. Header set Cache-Control "max-age=60, private, proxy-revalidate"
  16. </FilesMatch>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.