Compress all your web content with Gzip via the .htaccess file.


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



Copy this code and paste it in your HTML
  1. ################ COMPRESS EVERYTHING WITH GZIP ################
  2. <IfModule mod_deflate.c>
  3. # Insert filter
  4. SetOutputFilter DEFLATE
  5.  
  6. # Netscape 4.x has some problems...
  7. BrowserMatch ^Mozilla/4 gzip-only-text/html
  8.  
  9. # Netscape 4.06-4.08 have some more problems
  10. BrowserMatch ^Mozilla/4\.0[678] no-gzip
  11.  
  12. # MSIE masquerades as Netscape, but it is fine
  13. # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  14.  
  15. # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
  16. # the above regex won't work. You can use the following
  17. # workaround to get the desired effect:
  18. BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  19.  
  20. # Don't compress images
  21. #SetEnvIfNoCase Request_URI \
  22. #\.(?:gif|jpe?g|png)$ no-gzip dont-vary
  23.  
  24. # Make sure proxies don't deliver the wrong content
  25. Header append Vary User-Agent env=!dont-vary
  26. </IfModule>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.