title: How can I use gzip compression for .css and .js files on my websites?
body: <p>I have been toiling for days to get gzip compression working on the websites I have on my shared hosting server. I've had a certain level of success but sadly .css and .js files are being left out, despite my best efforts. Since I'm using shared hosting, I have no access to the apache configuration file, so I have resorted to using my .htaccess file to achieve this.</p>
  
  <p>The site I'm currently working on is <a href="http://www.peak-heat.co.uk">Peak Heat</a>, running Wordpress, and below is the .haccess file I'm using:</p>
  
  <pre><code># compress text, html, javascript, css, 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/js
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  
  ## EXPIRES CACHING ##
  &lt;IfModule mod_expires.c&gt;
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 week"
  &lt;/IfModule&gt;
  ## EXPIRES CACHING ##
  
  &lt;IfModule mod_headers.c&gt;
    &lt;FilesMatch "\.(js|css|xml|gz)$"&gt;
      Header append Vary Accept-Encoding
    &lt;/FilesMatch&gt;
  &lt;/IfModule&gt;
  
  &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>When I check the site using Firebug v1.8.3 with Google PageSpeed v1.12, it shows that the following files haven't been compressed:</p>
  
  <blockquote>
    <p>/wp-includes/js/jquery/jquery.js?ver=1.6.1</p>
    
    <p>/wp-content/themes/peak-heat/script/global.js</p>
    
    <p>/wp-content/plugins/contact-form-7/jquery.form.js?ver=2.52</p>
    
    <p>/wp-content/themes/peak-heat/style.css</p>
    
    <p>/wp-content/plugins/contact-form-7/scripts.js?ver=3.0</p>
    
    <p>/wp-content/plugins/contact-form-7/styles.css?ver=3.0</p>
    
    <p>/wp-content/plugins/testimonials-widget/testimonials-widget.css</p>
  </blockquote>
  
  <p>Checking the website URL itself with the <a href="http://www.gidnetwork.com/tools/gzip-test.php">online GIDZipTest</a> site, it confirms that compression is enabled, but when I check the above .css and .js files, it says that they're not compressed.</p>
  
  <p>What can I do to include all .css and .js files when compressing my site?</p>