More

    GZip compression: what it is and how it is activated 2020

    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.

    Enable GZip compression to improve performance

    What is GZip Compression

    There GZip compression is a system that reduces the size of your web pages and CSS, JavaScript and XML files, thereby improving loading times.

    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

    zip file

    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:

    
      # Compress HTML, CSS, JavaScript, Text, XML and fonts
      AddOutputFilterByType DEFLATE application/javascript
      AddOutputFilterByType DEFLATE application/rss+xml
      AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
      AddOutputFilterByType DEFLATE application/x-font
      AddOutputFilterByType DEFLATE application/x-font-opentype
      AddOutputFilterByType DEFLATE application/x-font-otf
      AddOutputFilterByType DEFLATE application/x-font-truetype
      AddOutputFilterByType DEFLATE application/x-font-ttf
      AddOutputFilterByType DEFLATE application/x-javascript
      AddOutputFilterByType DEFLATE application/xhtml+xml
      AddOutputFilterByType DEFLATE application/xml
      AddOutputFilterByType DEFLATE font/opentype
      AddOutputFilterByType DEFLATE font/otf
      AddOutputFilterByType DEFLATE font/ttf
      AddOutputFilterByType DEFLATE image/svg+xml
      AddOutputFilterByType DEFLATE image/x-icon
      AddOutputFilterByType DEFLATE text/css
      AddOutputFilterByType DEFLATE text/html
      AddOutputFilterByType DEFLATE text/javascript
      AddOutputFilterByType DEFLATE text/plain
      AddOutputFilterByType DEFLATE text/xml
    
      # Remove browser bugs (only needed for really old browsers)
      BrowserMatch ^Mozilla/4 gzip-only-text/html
      BrowserMatch ^Mozilla/4.0[678] no-gzip
      BrowserMatch bMSIE !no-gzip !gzip-only-text/html
      Header append Vary User-Agent
    

    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?

    There GZip compression it only affects pages and CSS, JavaScript, XML, text and font files, while other files such as images, PDFs and videos will not be optimized.

    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.

    Conclusion

    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!

    Latest articles

    ▷ Google Ads: Auction Strategies WAU Websites Are Us

    This is because there are many customizations, strategies, etc. that can offer the desired result. In this article we will focus on auction strategies as...

    ▷4 best online chat tips for beauty salons

    Online chat can be ideal for scheduling appointments at your beauty salon. Here are some tips on how to use...

    ▷What is Pareto Principle and how to use it in your business

    Did you know that the numbers 80 and 20 have a statistical connection? It is very likely that 80% of the profit generated...

    ▷How to take advantage of high online sales with a good ecommerce platform

    You may have seen several news about the good moment that London e-commerce has been experiencing in recent years. The expectation is that...

    Related articles