How to Enable Gzip Compression in WordPress

How to Enable Gzip Compression in WordPress

by admin

Used by more than half of all websites, Gzip Compression remains popular today.

According to W3Techs.com, 55.3% of all websites, including major sites like Microsoft.com, Github.com, and Apple.com, use gzip compression technology.

As the name suggests, Gzip is a compression technology. This technology compresses static files on the server side and sends them to browsers. Browsers will then automatically decompress and display these compressed files. This process makes the web page open faster.

Enabling it is extremely easy if you know which web server you have.

1. How Enable Gzip Compression in Apache

In order to enable gzip compression on Apache servers, the mod_deflate module must be installed. Almost all hosting companies install the mod_deflate module on their servers, so you don’t have to worry.

You need to add the following code into the .htaccess to enable gzip in Apache servers.

# BEGIN Gzip

AddType x-font/woff .woff
AddType x-font/ttf .ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE x-font/ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf

# END Gzip

Note: If gzip is not active despite following the instructions above, we recommend contacting your hosting company.

2. How Enable Gzip Compression in Nginx

On servers using Nginx, gzip compression cannot be activated automatically, so you have to enable gzip compression manually.

You need to add the following code into the /etc/nginx/nginx.conf to enable gzip in Nginx servers. Do not add anywhere. You should add it inside the http {} section.

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types image/svg+xml text/plain text/html text/xml text/css text/javascript application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript application/x-font-ttf application/vnd.ms-fontobject font/opentype font/ttf font/eot font/otf;

After adding the gzip compression lines, save and close the config file and restart NGINX with the command.

sudo service nginx restart

3. How Enable Gzip Compression By WordPress Plugin

The easiest way to activate gzip compression is to use a wordpress plugin and the best plugin for this is the WP Fastest Cache plugin.

WP Fastest Cache is the best WordPress cache plugin because It has many speed optimization features, including gzip compression. If you are using Apache web server, you can activate gzip compression with just one click, so you don’t have to deal with modifying the htaccess file.

WP Fastest Cache Settings

Can Gzip Compression Really Speed Up Web Site?

Let me point out right away that; Speeding up a website without using gzip compression is quite difficult. Gzip compression can reduce the size of a website by 50% on average. We did a little comparison to show how effective gzip compression is.

As seen in the example below, Gzip compression reduced the size of our website by about 53%.

Without Gzip Compression

Without Gzip Compression

With Gzip Compression

With Gzip Compression

Gzip is simply one of the many speed optimization techniques, here are 25+ ways to speed up your Elementor website.

Related articles

Placeholder Image
How to Enable Gzip in Webuzo with Nginx

There is no .htaccess file in Nginx servers so WP Fastest Cache cannot set the gzip rules. Therefor, you must…

How to Enable Leverage Browser Caching on Nginx
How to Enable Leverage Browser Caching on Nginx

You can enable Leverage Browser Caching via the settings page of WP Fastest Cache for Apache servers but You cannot…

How to Serve WebP Images on Nginx
How to Serve WebP Images on Nginx

After the images are optimized, they are served as webp on Apache servers automatically. However, this situation is not possible…

Ready to get started?

Purchase your first license and see why 1,500,000+ websites globally around the world trust us.