Gzip Compression : Speed up WordPress site

Posted by on

Share this

enable GZIP compression

Enabling the GZIP compression is the best way to speed up your WordPress website. In this tutorial, I will show you how to enable GZIP compression on WordPress website. Well, it is an easy process which will hardly take 10 minutes.

enable GZIP compression

enable GZIP compression

What is GZIP Compression?

It is basically a type of compression which is used to load your website elements faster than usual. Suppose if you’ve enabled GZIP compression on your website, this will gradually decrease your page size to half. Isn’t it amazing? The drawback of using this technique is, sometimes you may feel that your website has lost some of its visual qualities.

Enabling GZIP compression for HTML, CSS, and Javascript files increases your website loading speed up to 50%. As it compresses the unused elements and stops them from loading on the desktop and mobile devices.

This is one of the greatest factors of SEO too. As you all know, that Page speed has become one of the important ranking factors of SEO. You might like this great post by my mate Satyansh, How your website speed affects SEO.

If you have not enabled GZIP compression do it now because there are many others in the competition. And if you’re slow you’re weak. To check that whether you have already enabled GZIP compression on your website visit this link. Because some of the web server providers enable it by default.

GZIP can easily be implemented on any WordPress website by adding some codes to your .htaccess file.

Note : .htaccess file is very sensitive file and before making any change make sure you’ve downloaded it.

There are many other methods too but let’s start with the simplest one 🙂

GZIP Compression can be enabled differentially for different web servers. Mostly the file structure of a .htaccess file for Apache and NGINX web servers are different. Hence, there are variations in its functions too.

Enabling GZIP compression with .htaccess file

.htaccess file is a very sensitive file of your web server. Basically, this file controls all the information to be viewed by the visitors and non-admins of your website. Before making any changes to your .htaccess file I recommend you to download it safely to your computer.

You cannot edit your .htaccess file using WordPress. For that, you’ll have to login into your CPanel and after that, you’ll find a file named “.htaccess” in your public_html folder. Open the file “.htaccess” paste this code (given below) in the beginning.

After adding this code to your website hit the save button and try reloading the Web page. Consider to clean your website cache so that it can take effect more gracefully. It will definitely work for your website.

Enabling GZIP compression on Apache web servers

The code above should work for Apache web servers. If somehow it is not suitable or not working properly on your site then you can try this one. Before adding this consider removing the above one.

Check that whether this code working on your website. Either of this code will definitely work on your web server.

The codes mentioned above are only applicable for Apache web servers (not NGINX)

Enabling GZIP compression on NGINX web servers

For activating GZIP compression on NGINX web servers copy the code given below and paste it into your configuration file.

To test that whether the above methods are successfully working for you : check for GZIP compressions.

I will not recommend this method, absolute beginner. If you’re an absolute beginner and don’t know much about codes, you can install this plugin which may help you in GZIP compression of your website elements.

By adding this function to your website, it will definitely run faster. Happy Blogging.

You may also like: How to speed up your WordPress website?

Enable GZIP compression on WordPress

Last updated: June 16, 2016

Authored by :

Hi ! I'm Prakhar Shrivastav, currently a final year BSc student and a co-founder of 3nions. I love spending quality times on Web development, Graphic designing, and SEO.

3 comments

Great article prakhar. It can be useful for those websites who have a high bounce rate.

Hi Sagar,
You’re Right. It will definitely help those sites which are lacking traffic because of low speed and high bounce rates.

Thank you, this article realy helped me speed up my website, now i am big fan of your website and check all tech issue here ..

Leave a Reply