How to Enable GZIP Compression in WordPress

How to Enable GZIP Compression in WordPress

One of the first solutions to achieve faster load times of your WordPress CMS is to decrease the size of your page.The simplest method to reduce the size of your website, and improve the time to first render of your web pages, is to enable GZIP compression. Enabling GZIP compression on your server can significantly reduce the amount of time to download the requested resource. Today we will show you how to enable GZIP compression on WordPress. 

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer

Now just $43 .99


How to Check if GZIP Compression is Enabled

If you want to check if the GZIP compression has already been enabled on your site, all you have to do is to search the Internet and look for’GZIP compression online check’. This for sure is one of the easiest ways to check if the GZIP is enabled on your server.

How To Enable Gzip Compression For WordPress Websites

There are several different methods that you can use in order to enable GZIP compression on your WordPress website, so let’s dive into.

Enable GZIP on Apache

TO enable GZIP compression on Apache web server, you need to edit your .htaccess file. The following lines of code needs to be added to your .htaccess file. The .htaccess file can be found in the root or the WordPress site.

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml

# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

Enable GZIP with WordPress Plugin

You can use a caching plugin which supports GZIP compression,  as one of the simplest ways. For example, the WP Rocket will add the rules of GZIP compression to your .htaccess file and it will automatically use mod_deflate. If you want to enable this through W3 Total Cache you need to go under it`s performing section and enable it.

Enable GZIP on NGINX

If you are running on NGINX, all you have to do is to add the following lines to your nginx.conf configuration file.

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_vary on;
gzip_types text/plain text/css text/javascript image/svg+xml image/x-icon application/javascript application/x-javascript;

Of course, you don’t have to Enable GZIP Compression in WordPress, if you use one of our fully-managed WordPress VPS Hosting, in which case you can simply ask our expert Linux admins to help you with how to enable GZIP Compression in WordPress. They are available 24×7 and will help you how to enable GZIP Compression in WordPress, immediately!

PS. If you liked this post on How to Enable GZIP Compression in WordPress,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks

Leave a Comment