title: How to make gzip work on 1and1 shared host WordPress site
body: <p>YSlow is telling me that my css should be compressed, but after several hours of tinkering, I cannot for the life of me get gzip to work for my website.  At this point, I'm not even sure if the performance increase (will there be one?) will be worth the effort.</p>
  
  <p>I'm running a WordPress site on a 1&amp;1 shared hosting account.</p>
  
  <p>Honestly, I don't really know what I'm doing with this stuff, and can't seem to get an appropriate setup.  I read in a few places that with 1&amp;1, "modules Apache mod_deflate and mod_gzip are not installed.", so I assume this is part of the problem.</p>
  
  <p><strong>I have tried the following code:</strong></p>
  
  <p>This one doesn't seem to do anything:</p>
  
  <pre><code>&lt;IfModule mod_gzip.c&gt;  
      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.*  
  &lt;/IfModule&gt;  
  </code></pre>
  
  <p>This causes a 500 error</p>
  
  <pre><code>&lt;Location /&gt;
  # Insert filter
  SetOutputFilter DEFLATE
  
  # Netscape 4.x has some problems...
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  
  # Netscape 4.06-4.08 have some more problems
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  
  # MSIE masquerades as Netscape, but it is fine
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  # Don't compress images
  SetEnvIfNoCase Request_URI \
  \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  
  # Make sure proxies don't deliver the wrong content
  Header append Vary User-Agent env=!dont-vary
  &lt;/Location&gt;
  </code></pre>
  
  <p>This (from html5 boilerplate) doesn't seem to do anything either:</p>
  
  <pre><code>&lt;IfModule mod_deflate.c&gt;
  
    # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
    &lt;IfModule mod_setenvif.c&gt;
      &lt;IfModule mod_headers.c&gt;
        SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
        RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
      &lt;/IfModule&gt;
    &lt;/IfModule&gt;
  
    # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
    &lt;IfModule filter_module&gt;
      FilterDeclare   COMPRESS
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/x-icon
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
      FilterChain     COMPRESS
      FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
    &lt;/IfModule&gt;
  
  
    &lt;IfModule !mod_filter.c&gt;
      # Legacy versions of Apache
      AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
      AddOutputFilterByType DEFLATE application/javascript
      AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
      AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
      AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
    &lt;/IfModule&gt;
  
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>This one Doesnt seem to do anything...</p>
  
  <pre><code>AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
  </code></pre>
  
  <p>I followed the tutorial found here </p>
  
  <pre><code>(http://mrrena.blogspot.com/2009/01/how-to-compress-php-and-other-text.html) 
  </code></pre>
  
  <p>but this essentially completely broke the appearance of my site.</p>
  
  <hr>
  
  <p>Tried this in my Functions.php, and it seemed to compress my html, but leaves some js and css uncompressed</p>
  
  <pre><code>if(extension_loaded("zlib") &amp;&amp; (ini_get("output_handler") != "ob_gzhandler"))
      add_action('wp', create_function('', '@ob_end_clean();@ini_set("zlib.output_compression", 1);'));
  </code></pre>