Last updated on September 23rd, 2022 at 11:33 am
This is a good way to make your site significantly faster.
Even high-powered web servers can benefit from good compression.
Everyone wants a faster website. In fact, website performance is one of the key attributes used by Google when turning up search results. If a page takes longer than 4-5 seconds to load, most web surfers today abandon it and move to another site. One of the most powerful methods of serving your site faster is to incorporate GZIP compression.
What is GZIP Compression?
In a nutshell, GZIP compression allows your website to compress large files before sending them to your visitor. Smaller files transfer quicker, and the visitor’s web browser simply unzips them on the receiving side. GZIP compression can shrink the network traffic needed to view your website by as much as 80%!
How about Mod Deflate?
Mod Deflate is another compression scheme similar to GZIP.
Are You Using GZIP?
Depending on your web host, you may have GZIP enabled and not even know it. Before making changes, test your website URL at WhatIsMyIp.org. If the tool returns that you’re using compression, then there’s nothing else for you to do (unless you want to try different compression types). If the tool shows no compression on your website, keep reading…
Enable GZIP Compression
In some cases, you’ll have to ensure that your host has one of these compression methods available. Typically, if you access your hosting account using CPanel, you can check the Optimization menu to make sure your account is set to compress all files. After that, you’ll still have some work to do in your .htaccess file. You might have to check with your host just to be sure.
For Apache Servers:
Add the following line to your .htaccess file:
Alternatively, you can add this block of code if you expect significant traffic from older browsers:
For Servers using NGINX
If your site happens to be running on IIS (a Windows-based web server), then follow these instructions for enabling GZIP.