Page 1 of 1

Compressing text elements on your web server

Posted: Wed Jan 22, 2025 9:28 am
by tongfkymm44
Background
When we want to improve the WPO score on our website, an important point, which is not always considered, refers to the download speed of the website from our server to the client's browser.

We can slim down our HTML , expand our server's resources, but what we have little influence on is the path between the browser and our server.

One way to act on this variable is to make all the information we send smaller . This will make it arrive sooner under the same speed conditions.

Making something smaller is achieved by compressing the data.

Compression is the process of encoding information using fewer bits.

Ilya Grigorik – Google Developer Advocate and Web Perf Guru
What is GZIP?
It is a lossless compression format based on the LZ77 algorithm and Huffman coding.

In summary, its operation is based on locating duplicate text strings and jewelers email databasereplacing them with references to the first repetition. In this way, the compressed block is much smaller.

This encoding only works well with text content such as html, javascript or css.

Using GZIP on image or video files will offer almost no improvement since they are already compressed.

How can we check if our website has it active?
There are many online tools to verify it, from the wpo checking systems themselves such as Page Speed ​​Insights , WebPageTest or GTMetrix to specific tools such as Varvy :

Web compression test
On most web servers, GZIP is installed and enabled by default . But we must be careful to ensure that GZIP is applied to all text content and not just HTML.

For example, check in Varvy that both javascript and css are also sent to the client browser in compressed format:

CSS compression test
How can we activate it?
If we are using an administration panel such as Plesk or cPanel, we would have to go to the web server configuration section and look for the option to serve compressed pages.

For example, in cPanel, we would access the Optimize Website section

Enable compression in cPanel
In Plesk we have to confirm that we have the deflate and filter modules active:

Activate deflate plugins in cPanel
Then, add the configuration to the .htaccess file using the panel. For example, for the Apache web server it would be:

Enable gzip via htaccess
In other control panels we would have to locate the equivalent sections and consult their documentation.

If we do not have active panels or we want to directly add the configurations to the servers, below we show how to do it.