Advertisement
eerrtt

htaccess

Dec 8th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. <IfModule mod_deflate.c>
  2. # Insert filter
  3. SetOutputFilter DEFLATE
  4.  
  5. # Netscape 4.x has some problems...
  6. BrowserMatch ^Mozilla/4 gzip-only-text/html
  7.  
  8. # Netscape 4.06-4.08 have some more problems
  9. BrowserMatch ^Mozilla/4\.0[678] no-gzip
  10.  
  11. # MSIE masquerades as Netscape, but it is fine
  12. # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  13.  
  14. # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
  15. # the above regex won't work. You can use the following
  16. # workaround to get the desired effect:
  17. BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  18.  
  19. # Don't compress images
  20. SetEnvIfNoCase Request_URI \
  21. \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  22.  
  23. # Make sure proxies don't deliver the wrong content
  24. Header append Vary User-Agent env=!dont-vary
  25. </IfModule>
  26. <ifModule mod_gzip.c>
  27. mod_gzip_on Yes
  28. mod_gzip_dechunk Yes
  29. mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  30. mod_gzip_item_include handler ^cgi-script$
  31. mod_gzip_item_include mime ^text/.*
  32. mod_gzip_item_include mime ^application/x-javascript.*
  33. mod_gzip_item_exclude mime ^image/.*
  34. mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  35. </ifModule>
  36.  
  37. <ifModule mod_expires.c>
  38. ExpiresActive On
  39. ExpiresDefault "access plus 1 seconds"
  40. ExpiresByType text/html "access plus 1 seconds"
  41. ExpiresByType image/gif "access plus 2592000 seconds"
  42. ExpiresByType image/jpeg "access plus 2592000 seconds"
  43. ExpiresByType image/png "access plus 2592000 seconds"
  44. ExpiresByType text/css "access plus 604800 seconds"
  45. ExpiresByType text/javascript "access plus 216000 seconds"
  46. ExpiresByType application/x-javascript "access plus 216000 seconds"
  47. </ifModule>
  48.  
  49. <ifModule mod_headers.c>
  50. <filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
  51. Header set Cache-Control "max-age=2592000, public"
  52. </filesMatch>
  53. <filesMatch "\\.(css)$">
  54. Header set Cache-Control "max-age=604800, public"
  55. </filesMatch>
  56. <filesMatch "\\.(js)$">
  57. Header set Cache-Control "max-age=216000, private"
  58. </filesMatch>
  59. <filesMatch "\\.(xml|txt)$">
  60. Header set Cache-Control "max-age=216000, public, must-revalidate"
  61. </filesMatch>
  62. <filesMatch "\\.(html|htm|php)$">
  63. Header set Cache-Control "max-age=1, private, must-revalidate"
  64. </filesMatch>
  65. </ifModule>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement