If – for whatever reason – you’re not using a caching plugin, such as (affiliate link) WP Rocket (review) or W3 Total Cache, or you’re using one, but for some reason, the gzip compression feature is not working, then you can enable it manually in your .htaccess file.
For example, when I set up a light WordPress website or blog for a client, and he/she is using (affiliate link) SiteGround hosting (review), I prefer using their SG Optimizer plugin, in case the client doesn’t want to use or can’t afford WP Rocket.
But the SG Optimizer plugin doesn’t enable gzip compression by default, so I have to add it manually.
Before showing you how to enable gzip compression in WordPress using the .htaccess file, let me briefly tell you what it is.
What is GZIP compression?
When a user visits your website, the server has to deliver the files in order to display the website.
Now, the bigger the files, the longer it will take them to reach the user’s browser to display the website.
By enabling gzip compression, the files will get compressed before reaching your browser, making them smaller, therefore improving the delivery time.
Enable gzip compression in WordPress using .htaccess
mod_deflateenabled on your server! If it’s not, then you have to talk to your web host.
Step 1 – Access your website’s .htaccess file
You’ll need to access the .htaccess file of your WordPress website, which should normally be in the root folder –
If you’re using an add-on domain, not the main one, then you should look in
Here’s how to access your WordPress website’s files.
Step 2 – Add the gzip compression code
Copy the below code and paste it in the .htaccess file, right before the
#BEGIN WordPress line.
Here’s how it looks like on my end:
Don’t forget to save the file!
You can use this tool to see if you have successfully enabled gzip compression for your WordPress website.
You might also need to enable browser caching in WordPress via .htaccess if you don’t have it already.
That’s a wrap
I hope you found the post useful and comprehensive!
Don’t forget to share the post to help out others!
You can quickly subscribe to my newsletter by using this link.
If you have any questions or thoughts, drop a comment or send a message via contact or Facebook page.
You can also hit the follow button on Twitter and subscribe to the YouTube channel.
My WordPress installation service is at your disposal!
On-going WordPress support and maintenance services are on the menu as well!
Leave A Comment