htaccess - turn on gzip compression


Why do you want to even think turning on that on-the-fly content compression? In theory using Lossless compression should be used everywhere when transporting data - because is a such wonderful mathematic concept in comparison to the CPU power needed and the transmission benefit. Here we have a few other advantages:

  1. Google likes your webpage a bit more when you use it
  2. End-User likes your webpage because it should run smoothly

Now, not every hosting provider allows you to use it - they simply care you loose your bandwidth fast or they care about they CPUs which are overselled already.

To check if your website is using gzip compression now - use this page

If not, try to add this code to the .htaccess onto your website:


<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
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
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/ \
application/x-font-ttf \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \


Now check compression status on your webpage again.