Posted By

cbrant on 06/27/08


Tagged

apache cache cache-control modexpires


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

cbrant


Apache Cache Control using mod_expires with Expires By Type


 / Published in: Apache
 

URL: http://www.bytechemist.com/2008/06/27/apache-cache-control-using-mod_expires-with-expires-by-type/

Use Apache's mod_expires to explicitly set the expiration of a file by it's type. This will enable to browser to cache these static assets and greatly increase performance.

  1. <IfModule mod_expires.c>
  2. ExpiresActive on
  3. ExpiresDefault "now"
  4. ExpiresByType text/html "now"
  5. ExpiresByType text/xml "now"
  6. ExpiresByType text/css "access plus 8 hours"
  7. ExpiresByType text/plain "access plus 8 hours"
  8. ExpiresByType application/x-javascript "access plus 8 hours"
  9. ExpiresByType application/x-shockwave-flash "access plus 8 hours"
  10. ExpiresByType application/pdf "access plus 8 hours"
  11. ExpiresByType image/gif "access plus 8 hours"
  12. ExpiresByType image/png "access plus 8 hours"
  13. ExpiresByType image/jpeg "access plus 8 hours"
  14. ExpiresByType image/x-icon "access plus 8 hours"
  15. ExpiresByType video/x-flv "access plus 8 hours"
  16. ExpiresByType video/quicktime "access plus 8 hours"
  17. </IfModule>

Report this snippet  

You need to login to post a comment.