Enable Gzip Compression WordPress

by Mike Lugar
image title

It is very simple to enable gzip compression in WordPress. If you are looking to free up some bandwidth and lower your transfer volume to your visitors, you will definitely want to use gzip.

There are two main methods to enabling gzip, either through the use of a plugin, or by editing your website’s .htaccess file. Many popular caching plugins like W3 Total Cache and WP Super Cache have options to enable gzip compression. For example, the image above is an example of the gzip compression setting in WP Super Cache.

Enable Gzip Through .htaccess (Apache)

If your web server runs Apache, place the below code in your .htaccess file:

Enable Gzip For Nginx

If your web server uses Nginx, enabling gzip requires you to enable to module. You will need sudo and edit this file:

In this file you will see that the gzip settings are commented out. You will need to uncomment the gzip settings and adjust them to your desired result.

Save the nginx.conf file, and then reboot the Nginx service with the below command:

Mike is the managing member at MSLtek and is an avid web consultant and web developer. He enjoys solving complex problems and building awesome stuff.

Posted on February 5, 2017

Leave a Reply

Your email address will not be published. Required fields are marked *

Would you like us to send you a quote?

Get A Quote