Posted By

justinscheetz on 09/02/11


Tagged

htaccess speed cache boost caching


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

wrximpreza1987


Htaccess Speed Boost


 / Published in: Apache
 

  1. # Start Gzip
  2. <IfModule mod_deflate.c>
  3. AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
  4. AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
  5. AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
  6. AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
  7. AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
  8. AddOutputFilterByType DEFLATE font/truetype font/opentype
  9. </IfModule>
  10.  
  11. # BEGIN Expire headers
  12. <ifModule mod_expires.c>
  13. ExpiresActive On
  14. ExpiresDefault "access plus 1 seconds"
  15. ExpiresByType image/x-icon "access plus 2592000 seconds"
  16. ExpiresByType image/jpeg "access plus 2592000 seconds"
  17. ExpiresByType image/png "access plus 2592000 seconds"
  18. ExpiresByType image/gif "access plus 2592000 seconds"
  19. ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
  20. ExpiresByType text/css "access plus 604800 seconds"
  21. ExpiresByType text/javascript "access plus 216000 seconds"
  22. ExpiresByType application/javascript "access plus 216000 seconds"
  23. ExpiresByType application/x-javascript "access plus 216000 seconds"
  24. ExpiresByType text/html "access plus 600 seconds"
  25. ExpiresByType application/xhtml+xml "access plus 600 seconds"
  26. </ifModule>
  27. # END Expire headers
  28.  
  29. # BEGIN Cache-Control Headers
  30. <ifModule mod_headers.c>
  31. <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
  32. Header set Cache-Control "max-age=2592000, public"
  33. </filesMatch>
  34. <filesMatch "\.(css)$">
  35. Header set Cache-Control "max-age=604800, public"
  36. </filesMatch>
  37. <filesMatch "\.(js)$">
  38. Header set Cache-Control "max-age=216000, private"
  39. </filesMatch>
  40. <filesMatch "\.(x?html?|php)$">
  41. Header set Cache-Control "max-age=600, private, must-revalidate"
  42. </filesMatch>
  43. </ifModule>
  44. # END Cache-Control Headers
  45.  
  46. # BEGIN Turn ETags Off
  47. <ifModule mod_headers.c>
  48. Header unset ETag
  49. </ifModule>
  50. FileETag None
  51. # END Turn ETags Off
  52.  
  53. # BEGIN Remove Last-Modified Header
  54. <ifModule mod_headers.c>
  55. Header unset Last-Modified
  56. </ifModule>
  57. # END Remove Last-Modified Header

Report this snippet  

You need to login to post a comment.