How to fix Gzip Compression

How to fix Gzip Compression.

 

Increase web site speed


Read our other blogs on how to increase web site speed too.

Option 1. Editing .htaccess




 

Gzip compression via mod_deflate (recommended) can be enabled by implementing the following code to your .htaccess file (a guide on how to locate your .htaccess file is located in your public_html directory. You can quickly access the file and it’s content by right-cliking and selecting Edit:):

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml 
  AddOutputFilterByType DEFLATE application/x-font  
  AddOutputFilterByType DEFLATE application/x-font-truetype  
  AddOutputFilterByType DEFLATE application/x-font-ttf  
  AddOutputFilterByType DEFLATE application/x-font-otf 
  AddOutputFilterByType DEFLATE application/x-font-opentype 
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE font/ttf 
  AddOutputFilterByType DEFLATE font/otf 
  AddOutputFilterByType DEFLATE font/opentype
# For Older Browsers Which Can't Handle Compression
  BrowserMatch ^Mozilla/4 gzip-only-text/html 
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

If your server does not support mod_deflate you can try the mod_gzip alternative:

<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 mime ^application/x-javascript.*
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  mod_gzip_item_exclude mime ^image/.* 
  mod_gzip_item_include handler ^cgi-script$
</ifModule>

Once the changes are saved, gzip compression will be enabled and your web site should be faster. Go back to testing tools to verify the fix. Always call customer service if more help needed.

Option 2. CMS plug-ins

WordPress users can enable gzip compression by installing plugins such as GZip Ninja Speed Compression.

With Joomla, you can gzip your website via Sytem -> Global Configuration -> Server section. You can also view our guide on Joomla performances.

 

Option 3. Windows-based hosting

If you are using a Windows server, you can enable HTTP compression for static and dynamic content using the command line:

appcmd set config /section:urlCompression /doDynamicCompression:True

appcmd set config /section:urlCompression /doStaticCompression:True

For more specifics, you can view the official Microsoft guide .

Conclusion: 

It is easy to fix Gzip Compression issue and Increase web site speed. Your hosting company should also have tutorials about this as fixing Gzip Compression is very important step to increase web site speed


2 thoughts on “How to fix Gzip Compression”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.