Fix Enable Compression Issue of WordPress Site in Google PageSpeed

Serving compressed files improve the page loading speed of your WordPress site. If compression is not enabled this will be showing with highest priority issues when checked with Google PageSpeed Insights tool. In this article we will explain how to enable compression to speedup your WordPress site.

Check Site with Google PageSpeed Insights Tool

There are many tools to check whether the site URL is served after compression or not. Below is how Google PageSpeed Insights tool will show the error if compression is not enabled on your site.

Google PageSpeed Shows Compression Not Enabled
Google PageSpeed Shows Compression Not Enabled

Since this is high priority issue the page speed score is very low as 36 on desktops.

How to Enable Compression for on Your WordPress Site?

There are two ways you can enable compression on your WordPress site.

  1. Through cPanel hosting account
  2. Using .htaccess file

We will explain both the methods in detail.

Enable GZIP Compression Using cPanel

Most of the popular shared hosting companies like Bluehost, SiteGround, etc. use cPanel to host your account. If you have cPanel access for your WordPress installation then you can easily enable GZIP compression without modifying .htaccess file.

Login to your cPanel account and look for the option “Optimize Website”. On SiteGround cPanel this option is grouped under “Advanced” category as below:

Open Optimize Website Option in cPanel Hosting
Open Optimize Website Option in cPanel Hosting

Open “Optimize Website” option and choose “Compress All Content” button (by default this will be disabled). This will enable compression on your WordPress site henceforth all content will be compressed before served to users.

Enable GZIP Compression in cPanel
Enable GZIP Compression in cPanel

Enable Compression Using .htaccess File

Though cPanel has the option to enable compression some hosts may not allow you to enable this option or you may not have access to the hosting account. In such cases, GZIP compression can be enabled by adding the following code in your .htaccess file.

#BEGIN GZIP Compression
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# END GZIP Compression

1. The .htaccess file can be modified using plugins or with FTP access.

2. The .htaccess file will be located in the root WordPress installation directory that is “/public_html”. If you have installed WordPress on subdirectory then look for the file under that directory.

3. The .htaccess file in general is hidden, you may need to enable viewing the hidden files on your Mac or PC.

Checking Back in Google PageSpeed Insights Tool

Now that you have enabled compression on your WordPress site, it is time to check back with Google PageSpeed Insights tool. Before doing that ensure to flush all the caches from the caching plugin and server level. Now that you can see the “Enable Compression” is shown under “Passed Rules” indicating your page is enabled with GZIP compression. This will also improve the page speed score considerably.

Compression Enabled Successfully
Compression Enabled Successfully

Check Compression with Our Free SEO Tool

Other than Google’s tool there are many tools also offer functions to check the GZIP compression of a webpage. You can use free GZIP Compression Checker tool by entering your site URL and check how much bytes is saved using compression on your site.

GZIP Compression Checker
GZIP Compression Checker

Editorial Staff at WebNots are team members who love to build websites and share the learning with webmasters community. Connect with us in Facebook and Twitter.

Recommended Articles:

Leave a Comment