Enabling Gzip Compression in WordPress via .htaccess reduces Server Response Time and volume of data sent by server to web browser because of compressed page size. The best way to enable compression using mod_gzip or mod_deflate in WordPress .htaccess file. Gzip compression can be enabled by adding a simple code in WordPress .htaccess file of your website.
DEFLATE compression and Gzip Compression in WordPress
First you should check whether Gzip Compression is enabled or not on your WordPress site. Google for Gzip compression test tool. You also need to find out which server you are using Apache or Nginx. Because Gzip Compression method is different for both servers. You also need to figure out, how to edit WordPress .htaccess file if you are using Apache Server. Here is a detailed guide on How to edit WordPress .htaccess file.
You might have read on web about Gzip Compression and DEFLATE compression, both compression algorithms are different and used for different servers. Gzip compression is used on Apache and Nginx servers, while DEFLATE is only used on Apache servers.
Enable Gzip Compression in WordPress via .htaccess
To enable Gzip Compression in WordPress via .htaccess, you only need to copy and paste given below code in WordPress .htaccess file and save changes. Now check your site on compression testing tools again, it will definitely reduce your website page size significantly and will increase page-load speed.
Compression on Apache server
- Gzip Compression – Add following code in WordPress .htaccess file of your website.
- DEFLATE Compression – Copy and paste the following code in WordPress .htaccess file of your website.
Compression on Nginx server
- Gzip Compression – Paste the following code in configuration file of your website with Nginx server.
My blog TechNumero was hosted on Apache server, so I was/am using Gzip compression and DEFLATE compression both on my website. And it is reducing webpage size by 82.2%. Initially my web page size is 42,656 Bytes (without compression) and after compression my web page size is 7,596 Bytes only. Hence I am Saving 35,060 Bytes using Gzip Compression on Technumero.com.
Gzip Compression with WordPress Plugin – W3 Total Cache
W3 Total Cache is one of the most used caching plugin on WordPress. And if you are using this plugin, you can Enable Gzip compression via this plugin. Follow the given below steps to Enable Gzip compression with WordPress Plugin – W3 Total Cache
- Go to the W3 Total Cache Plugin Settings page
- Navigate to Browser Cache page
- And Check the Enable HTTP Compression option
- Dont forget to click on Save changes button and you are done.
Gzip Compression with WordPress Plugin – WP Super Cache
WP Super Cache is also a widely used Caching plugin. You can Enable Gzip compression in just one click with this plugin. Use the given below steps to Enable Gzip compression with WordPress Plugin – WP Super Cache
- Navigate to the WP Super Cache Plugin Settings page
- Click on the Advanced Tab and
- Now Enable the First option in Miscellaneous settings
- Save the changes and you are done.
Hope you will find this information useful. If have any question regarding Gzip compression in WordPress please post it in comment section below. Let us know which compression method you use on your site.