Today we talk about GZip compression, a topic that will surely interest you if you are looking to speed up your WordPress site.
We have already talked about the importance of having a fast and performing website (see, for example, the article Slow to load site: the guide to improving the speed of the site and The speed of the page as a ranking factor in searches ). And I think you agree with me too that everything should be done to constantly improve the loading times of your pages.
The first step is certainly to run a speed check with one of the best online speed tests. Using GTMetrix, in particular, you will certainly notice the voice “Enable compression”. It refers precisely to the GZip compression and in this article I will explain what it is and how it is enabled.
What is GZip Compression
Surely you know the .zip folders, that is the compressed folders that are often used to send attachments via email with the aim of reducing their size. GZip compression works in a similar way, but on the server where your website is hosted. Think that using it could reduce the size of your pages by up to 70%!
How GZip Compression Works
By activating GZip, a text file is created with strings that temporarily replace the code that makes up your page.
When a browser accesses a website, it checks if this setting is enabled. If it is, then it receives the compressed file and displays the complete page anyway, without any display problems but with much faster times.
You might ask yourself “But then there is an additional time in which the browser checks the setting?” No, the GZip check is done by the browser in any case, so it is not an extra task that will have to be performed. Simply, if it detects the presence of compression, it will load the compressed file, otherwise it will show the original page (which will take longer).
How to activate GZip compression
On Apache servers, ie those with Linux operating system, you will need to access the .htaccess file. Read our guide to the .htaccess file to know where to find it and how to edit it.
Go to the end of the file and add this code:
You will not have to change anything, it is ready to use so copy and paste it safely.
Once the file is saved on the server, test again with GTMetrix. You will notice that your score has improved!
In case your server is not Linux, I recommend that you ask your hosting technical support how you can activate compression.
Which files will be compressed?
I suggest you pay special attention to the optimization of images, which are often the main cause of a slow site. Use tools like compressjpeg.com or the Smush plugin to reduce their size.
Enable GZip compression It will certainly allow you to improve the performance of your website, but remember that there are many other techniques not to be overlooked!
If you need assistance in increasing the speed of your website, contact us now!
Did you know the GZip compression system?
What other techniques do you consider essential to improve the performance of a site?
Let’s talk about it in the comments!