Enabling GZIP Compression is one of the easiest things you can add to your website to greatly reduce the load time for your users. You can easily enable GZIP compression with a plugin, but that is a hassle and adds unnecessary bulk to your website. A better option is to enable GZIP compression with a few lines of code to your .htaccess file.
If you are on a decent host, most of them come with GZIP compression already enabled on the server. If you are looking to change your host, I recommend Siteground. (But, if you need to know how to enable it on your server, that is for another post coming soon!)
Step 1 Access .htacess file
To begin you will need to use one of the following:
- CPANEL file manager
- File Transfer Protocol (FTP)
- Tools Section of Yoast SEO
The tools section of Yoast SEO gives you the ability to modify your .htacess file. This makes it easier to modify it because you will not need to leave your WordPress admin panel.
Step 2: Enable GZIP Compression
I am going to assume that there are other lines and code in your .htaccess file, so you will want to add this at the very top of the file.
The good news is if you add this and mod_deflate is not installed it will not crash your website. Additionally, this code will GZIP .SVG files. We do not GZIP every file type because doing this with media files is ultimately a waste of server resources. Lastly, if you’re using .swf files, often times GZIP will break pre-loaders by making them appear broken on your website.