How to Easily Enable Gzip Compression in WordPress for Faster Loading
What is Gzip Compression
Gzip Compression is a method which compress files(make them smaller) and increase the speed to which they are transferred to the browser.
For example, When a user visit or click on your website, a call is made to your server to deliver the requested file. Requested files are counted the total number of articles and files in your page, which includes images, ads, widget, scripts, HTML, CSS, Java scripts etc. The bigger files you have, the more time it will take to appear on your screen. That why here comes the one of the best method called Gzip Compression. In this tutorial i am showing you how to enable Gzip Compression.
Why you need to Enable Gzip Compression on Your WordPress Website
As i mentioned above that Gzip Compression is one of the best way to optimise your website and also increase your page speed. It compresses your webpages and style sheets before sending them over to the browser. So if the total size of page is 100 KB , then only 10 KB file are sent to the browser. There are some benefits you are getting of using this, such as :
- Compress 100 KB file to 10 KB
- Reduces Page sizes & Increase page speed
- Cost-benefit ratio: high
Simply you can check your page speed using GTmetrix . This tool will show you is your server Gzip Compression enabled or not. There is another Gzip Compression checker tool you can use, Check GZIP compression.
You can see that 76% was saved by compressing this page with GZIP. The primary size of uncompressed files was 30,599 bytes, and after compressed it is now only 7,350 bytes.
This Gzip Compression process is totally free, so you don’t need to buy a service or any tool. You just need to have access to the .htaccess file.
How to Enable Gzip Compression in WordPress
There are several ways to enable Gzip Compression on webservers. You can enable it from .htaccess, NGINX and using plugin.
Enable Gzip Compression via .htaccess
For this method, you will need to access to your cPanel. In the WordPress root folder, add the following lines to .htaccess file.
Enable Gzip Compression on NGINX web servers
To enable compression in NGINX you will need to add the following code to your config file.
Enable Gzip Compression using Plugin
Download GZip Ninja Speed Compression plugin and activate from your Admin Dashboard. And done!