1. Home
  2. Hosting Management
  3. Website Speed
  4. How to enable GZIP compression

How to enable GZIP compression

In this tutorial, you will learn how to enable GZIP compression for your website. GZIP compresses your web pages and style sheets before sending them over to the browser. This drastically reduces transfer time since the files are much smaller.

Enabling Gzip compression isn’t difficult at all! All you need to do is add the following piece of code to your site’s .htaccess file:

<IfModule mod_deflate.c>
 # Compress HTML, CSS, JavaScript, Text, XML and fonts
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
 AddOutputFilterByType DEFLATE application/x-font
 AddOutputFilterByType DEFLATE application/x-font-opentype
 AddOutputFilterByType DEFLATE application/x-font-otf
 AddOutputFilterByType DEFLATE application/x-font-truetype
 AddOutputFilterByType DEFLATE application/x-font-ttf
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE font/opentype
 AddOutputFilterByType DEFLATE font/otf
 AddOutputFilterByType DEFLATE font/ttf
 AddOutputFilterByType DEFLATE image/svg+xml
 AddOutputFilterByType DEFLATE image/x-icon
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/xml

# Remove browser bugs (only needed for really old browsers)
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4\.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 Header append Vary User-Agent
</IfModule>

With this online tool, you can check if your web server is sending the correct GZIP enabled header.

If GZIP is properly enabled, the result will look like this:

 

 

 

That’s it! Now you know how to enable GZIP compression for your website.

If you are a ChemiCloud customer, we have you covered. GZIP compression is enabled by default on all our web hosting plans.

Updated on August 6, 2020

Was this article helpful?

Related Articles

🔥 Winter Special Deal!
Get 70% Off hosting plans + free domain & SSL!
👉 Start Saving

Comments

  1. Hey Vikas. Thanks for reaching out! The speed of your site depends on multiple factors. And the process of optimizing your site for better performance is different from one website to another. Your site seems to be running from a server using Apache as the webserver at a quick look. Why not consider a switch to a web host that’s using LiteSpeed? You should see a massive improvement in your site’s speed. You can read more on this topic at https://chemicloud.com/blog/litespeed-vs-nginx-vs-apache/

Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.