Advertisement
Guest User

compression

a guest
Oct 7th, 2012
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. <IfModule mod_expires.c>
  2. ExpiresActive On
  3. ExpiresDefault "access plus 1 seconds"
  4. ExpiresByType text/html "access plus 1 seconds"
  5. ExpiresByType image/gif "access plus 120 minutes"
  6. ExpiresByType image/jpeg "access plus 120 minutes"
  7. ExpiresByType image/png "access plus 120 minutes"
  8. ExpiresByType text/css "access plus 60 minutes"
  9. ExpiresByType text/javascript "access plus 60 minutes"
  10. ExpiresByType application/x-javascript "access plus 60 minutes"
  11. ExpiresByType text/xml "access plus 60 minutes"
  12. </IfModule>
  13.  
  14.  
  15. # These will enable GZIP compress for everything or all files served by Apache, exclude several file types stated at 'SetEnvIfNoCase'
  16. <IfModule mod_deflate.c>
  17. SetOutputFilter DEFLATE
  18.  
  19. <IfModule mod_setenvif.c>
  20. # Netscape 4.x has some problems
  21. BrowserMatch ^Mozilla/4 gzip-only-text/html
  22.  
  23. # Netscape 4.06-4.08 have some more problems
  24. BrowserMatch ^Mozilla/4\.0[678] no-gzip
  25.  
  26. # MSIE masquerades as Netscape, but it is fine
  27. BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  28.  
  29. # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48, the above regex won’t work. You can use the following
  30. # workaround (comment the above line and uncomment the below line) to get the desired effect:
  31. # BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  32.  
  33. # Don’t compress already-compressed files
  34. SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
  35. SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
  36. SetEnvIfNoCase Request_URI .(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)$ no-gzip dont-vary
  37. SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary
  38. SetEnvIfNoCase Request_URI \.doc$ no-gzip dont-vary
  39. </IfModule>
  40.  
  41. <IfModule mod_headers.c>
  42. # Make sure proxies don’t deliver the wrong content
  43. Header append Vary User-Agent env=!dont-vary
  44. </IfModule>
  45. </IfModule>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement