was successfully added to your cart.

Why & How to enable GZIP for your WordPress Site

By June 23, 2017Tips

What is GZIP compression of files?

GZIP is an application which is used to compress or decompress files. The compression needs to be enabled on server-side and it will help in compressing the size of HTML, javascript, and stylesheets.

Over the period of many years of managing WordPress sites we have observed that the file sizes get reduced by 70%. However, just so that you are aware of it, it is not used for the compression of the image.

Here’s how it works!

Whenever a user visits a website through their web browser, it verifies if it contains ‘content-encoding: gzip’ header. In case it does find, the website automatically shows up smaller and compressed files.

What are the benefits of enabling GZIP compression?

It is the most effective method to open a WordPress file faster as it compresses the size by 70%. The same site which took minutes to load can be loaded in few seconds. It is used widely in recent times. Here are some of the benefits which anyone can get through GZIP compression:

    • The search will prefer you more in search results.
    • Large server requests won’t be processed on your server.
    • The size of a page will be reduced from 800 Kb to 80 KB.

 

How to enable GZIP compression for your WordPress?

If you don’t have GZIP compression to reduce the size of WordPress files then you must look out for these mentioned ways to enable it:
W3 Total Cache

The most popular option is to just install the W3 Total Cache WordPress plugin. It is very helpful in improving the performance of your WordPress site.

To enable the GZIP compression with using W3 total cache, first, click on the performance and then opts for browser cache. After that, you need to select the Enable HTTP compression in the options shown.
Edit your .htaccess

The second most suitable way is to edit your .htaccess file. Most of the hosts that are shared use apache, which simply allows you to tag a quote just below the .htaccess file.

An example of .htaccess could be:

  
# 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
 

Compression plug-in

This option allows getting the page in GZIP compressed way. It can compress the size of the page by an average of 70%. To use this method you need to download WP HTTP Compression. Make sure you install and activate as well. And it works automatically so you don’t need to make effort as it will start showing compressed pages on its own.

Get Any WordPress Error Fixed for $39/month

Our wordpress experts will attend to you in minutes, once you submit the error details

 Unlimited fixes

 Daily Backups

Monthly Audits

 Free Hosting

24/7 service

SEO audit

Subscribe Now