2

I'm currently trying to increase the speed of my website and I noticed that, when I run it through ismyblogworking.com, I get a message that reads "your blog application doesn't support gzip compression."

Since then, I've tried quite a few things to enable gzip compression. I've updated my Wordpress to 3.8.1 (the most recent update), I've installed W3 Total Cache and I've added the follow code to my .htaccess:

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/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddType x-font/otf .otf
AddType x-font/ttf .ttf
AddType x-font/eot .eot
AddType x-font/woff .woff
AddType image/x-icon .ico
AddType image/png .png

However, I'm still getting the same warning sign, still ranking low for PageSpeed Insights. Can anybody give me some advice as to what I should be doing here? How can I get a WordPress site to enable gzip compression?

  • before getting into details about the rules on the .htaccess, have you asked on your hosting company if they support compression and what kind? – PatomaS Feb 14 '14 at 12:29
  • I haven't, although they are Bluehost which seem to be widely recommended for Wordpress, so I would expect they would. Is it common for hosting companies to disallow this? – Zetland Feb 14 '14 at 12:45
  • Many companies disable compression because of the overload it generates on the server. Specially poorly coded sites. Also, other hostings disable it by default but they enable it on a per user/site basis. I have no experience with them, so I can't say what they do, but I'd ask there first, it should be 5 minutes or less on a live chat. – PatomaS Feb 14 '14 at 12:52
  • Just to be sure, the first line in your code block compress text, ... is commented out (ie. #)? Or does not exist in your actual .htaccess code? – MrWhite Apr 18 '14 at 23:20
4

Put these lines in your .htaccess and PageSpeed Insights will see your gzip compression:

<IfModule mod_deflate.c>
<FilesMatch "\.(html|php|txt|xml|js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

It works for my sites.

  • Thanks. I already have this. <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xmltext/css application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </IfModule> Should I delete it and replace it with your code? – Zetland Feb 14 '14 at 13:24
  • 1
    Indeed, you can replace your code by the one I propose. – Zistoloen Feb 14 '14 at 13:43
  • And should I also switch off any cache plug-ins that I have installed on my Wordpress? – Zetland Feb 14 '14 at 13:57
  • 1
    Your intuition is good; indeed, several WordPress plugins can update the .htaccess file. Try to apply my code and keep switch on your plugin. It manages other things I suppose. If it doesn't work, try to deactivate the gzip compression on your plugin and if it's not possible, switch off it. – Zistoloen Feb 14 '14 at 14:28
  • I'm still struggling with this. Added it, but the gzip compression has been undetected so far. Actually, the only thing that worked was a plugin called Force Gzip, but that slowed my site down to half the original speed... – Zetland Feb 15 '14 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.