1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Gzip compression

Discussion in 'Server Configuration and Hosting' started by NeoCHI, Nov 4, 2014.

  1. NeoCHI

    NeoCHI Active Member

    I thought gzip compression was on by default but when I use gtmetrics to anayze my site, it shows it's not...what do I need to fix this?
  2. EQnoble

    EQnoble Well-Known Member

    You could add something like this to your htaccess if mod_gzip is available to you on your server
    <ifModule mod_gzip.c>
      mod_gzip_on Yes
      mod_gzip_dechunk Yes
      mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
      mod_gzip_item_include handler ^cgi-script$
      mod_gzip_item_include mime ^text/.*
      mod_gzip_item_include mime ^application/x-javascript.*
      mod_gzip_item_exclude mime ^image/.*
      mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  3. Solidus

    Solidus Well-Known Member

  4. NeoCHI

    NeoCHI Active Member

    my hosting service added:
    # compress text, HTML, JavaScript, CSS, and XML
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    # remove browser bugs
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent
    in in WHM under Apache includes editor, then select Pre Virtual Host Include. Will that do?

Share This Page