GZIP compression and your WordPress site

You are here:
Estimated reading time: 2 min

Site speed has become an important factor now that Google’s Core Web Vitals update is upon us. People are scrambling to change their sites from page builders to Gutenberg made pages because of this but there are a few things that can also be done to optimize your site speed.

GZIP compression can be important in speeding up your site. It compresses web files (HTML, CSS, JavaScript) to make them smaller, sometimes up to 70-80% smaller than their previous size. The compression can also be done to video or audio files, however, the results might be unexpected as in getting bigger files than the original.

There are three ways compression can be handled in your website:

  1. In your web server
  2. In the .htaccess file of your site
  3. Through a plugin in your WordPress site

Checking your site for compression

The first place you need to check for compression is your web server. Some web hosting companies have already included GZIP compression or Brotli compression in their configuration.

Go to this link at giftofspeed.com and test your site – https://www.giftofspeed.com/gzip-test/

Test your site for GZIP compression

Using a plugin to enable compression

If your site doesn’t have the compression you can add it by installing a plugin to your WordPress site.

There are several free plugins you can use in order to activate the improvements compression gives to your site. Search in the WordPress repository under plugins with the word ‘cache’ to find them.
Some of the suggestions I found in articles throughout the web are W3 Total Cache and WP Super Cache. There is also a paid option called WP Rocket that is suggested by a lot of professionals but I find it on the expensive site, especially if you need to use it on more than one site.

Search for cache plugins

Modifying .htaccess to enable compression

Even though this option was second on the list here and in many of the articles I researched, I left it for last because honestly, I don’t want you to be editing your .htaccess file AT ALL.

If you search for a definition of .htaccess in the web it will tell you it’s just a simple configuration file used for configuring your site at the folder level and for URL redirections. But I feel it’s more than that. Your .htaccess file is what keeps others from going into your uploads file and just browsing through the assets there. You can also do powerful things like password protecting files and directories.

I’m an informatics engineer and have been doing web development for over 20 years, and I DO NOT mess with .htaccess. I don’t include snippets on it found on the web or test things out in it. It’s a sacred file for me as far as I’m concerned and only experts should tangle with it.

That being said, some tutorials on speed optimization will give you scripts to add to your .htaccess file and modify it. But that really isn’t necessary because the WordPress caching plugins will actually modify this file for you depending on how you configure the plugin.

WordPress recommended .htaccess script

Resources

Compression Test GiftOfSpeed – https://www.giftofspeed.com/gzip-test/

Plugins

W3 Total Cache – https://wordpress.org/plugins/w3-total-cache/
WP Super Cache – https://wordpress.org/plugins/wp-super-cache/
WP Rocket – https://wp-rocket.me/

Htaccess – https://wordpress.org/support/article/htaccess/

Articles

WP Beginner – https://www.wpbeginner.com/wp-tutorials/how-to-enable-gzip-compression-in-wordpress/
Kinsta – https://kinsta.com/blog/enable-gzip-compression/

Conclusion

There are other ways to speed up your site like changing to a faster theme or finding a host with more capabilities, but you always want to start checking out what you already have at the server level.

Thank you for reading.

Was this article helpful?
Dislike 0
Views: 5