What is Gzip compression and what is it used for?

by Janeth Kent Date: 22-12-2022 gzip

GZIP compression allows you to compress the resources of a web page before they are served to the users' browsers so that the web page loads faster and thus improves your WPO.

This type of compression has become very popular in recent times among WPO consultants thanks to tools such as Google Page Speed Insights that have given it a lot of importance.

Moreover, this lossless compression format is royalty-free under Open Source license which has facilitated its diffusion.

However, the only downside of this type of compression is that although it is useful (and very useful) for HTML, CSS and JS files, it is not useful for optimising images as it barely compresses them.

In any case, implementing this compression on your website does not mean that it will be optimised in terms of loading speed. GZIP is not a panacea but it will help you a lot to improve the bandwidth consumed by your website when loading.

Why is it good to have GZIP compression activated?

Having GZIP compression enabled on your website will be beneficial because:

- It will compress your files and your website will load very fast.

- It will help Google bots to crawl your website faster and therefore optimise the Crawl Budget.

- All current browsers support GZIP compression.

How does GZIP compression work?

GZIP compression works in a simple way:

The server communicates to the web browser in the URL headers that the content is compressed.

In this way, the browser knows that the files are GZIP compressed and can decompress them before the user sees the content.

Enabling GZIP compression in Apache

To enable GZIP compression in Apache you will have to follow this process:

1. Access via FTP (Filezilla will do) to the .htaccess file on your Apache server.

2. Click on the .htaccess file in the root folder of your server and click on edit.

3. Once you are editing (just open it in a notepad) this file copy the following code to the beginning of the file:

<ifModule mod_gzip.c>  mod_gzip_on Yes  mod_gzip_dechunk Yes  
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$  
mod_gzip_item_include handler ^cgi-script$  mod_gzip_item_include mime ^text/.*  
mod_gzip_item_include mime ^application/x-javascript.*  
mod_gzip_item_exclude mime ^image/.*  
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*  

4. Once you save and upload the file you will have activated GZIP compression.

NOTE: Remember that in order for it to work, the mod_gzip extension must be activated in your hosting provider along with the mod_deflate extension.

Activate the GZIP/DEFLATE compression in cPanel

When activating the GZIP/DEFLATE compression from Cpanel it will be easier as you will not have to touch code and you will only have to follow these instructions:

1. Once inside Cpanel, go to the "Optimize website" section.

2. Check the option "Compress all content".

That's it.

With this system you will have compressed your website using GZIP or the DEFLATE method, which is roughly equivalent to GZIP in Apache.

Image  Freepik
by Janeth Kent Date: 22-12-2022 gzip hits : 1483  
Janeth Kent

Janeth Kent

Licenciada en Bellas Artes y programadora por pasión. Cuando tengo un rato retoco fotos, edito vídeos y diseño cosas. El resto del tiempo escribo en MA-NO WEB DESIGN AND DEVELOPMENT.