htaccess perfromance rules


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



Copy this code and paste it in your HTML
  1. # Begin performance rules
  2.  
  3. <ifModule mod_gzip.c>
  4. mod_gzip_on Yes
  5. mod_gzip_dechunk Yes
  6. mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  7. mod_gzip_item_include handler ^cgi-script$
  8. mod_gzip_item_include mime ^text/.*
  9. mod_gzip_item_include mime ^application/x-javascript.*
  10. mod_gzip_item_exclude mime ^image/.*
  11. mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  12. </ifModule>
  13.  
  14. <ifModule mod_deflate.c>
  15. AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript
  16. </ifModule>
  17.  
  18. <ifModule mod_expires.c>
  19. ExpiresActive On
  20. ExpiresDefault "access plus 1 seconds"
  21. ExpiresByType text/html "access plus 1 seconds"
  22. ExpiresByType image/gif "access plus 3 months"
  23. ExpiresByType image/jpeg "access plus 3 months"
  24. ExpiresByType image/png "access plus 3 months"
  25. ExpiresByType image/ico "access plus 3 months"
  26. ExpiresByType image/icon "access plus 3 months"
  27. ExpiresByType image/x-icon "access plus 3 months"
  28. ExpiresByType text/css "access plus 3 months"
  29. ExpiresByType text/javascript "access plus 3 months"
  30. ExpiresByType application/x-javascript "access plus 3 months"
  31. </ifModule>
  32.  
  33.  
  34.  
  35. <ifModule mod_headers.c>
  36. Header unset ETag
  37. Header unset Last-Modified
  38. <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|js|css)$">
  39. Header set Cache-Control "public, no-transform"
  40. </FilesMatch>
  41.  
  42. </ifModule>
  43. FileETag None
  44.  
  45. #end performance rules

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.