You are currently viewing Speed Up Your WordPress Site with gzip

Speed Up Your WordPress Site with gzip

Just like image compression, gzip compresses files on your website which makes it load faster. There are plugins you can install that will do this for you, however some plugins can actually slow your site down or break certain features.

The leanest way to compress files on your WordPress site is by adding some code to your .htaccess file. Editing your .htaccess file allows you to change the configuration on your website without accessing the server side configuration files. All you need to edit .htaccess is access to your cPanel.

You should make sure that your website is not already using gzip or brotli. You can run a test here.

Step 1: Log into your cPanel

Speed up your wordpress site with gzip compression

Step 2: Click on “File Manager”

Speed up your wordpress site with gzip compression

Step 3: Click on “Public HTML”

Speed up your wordpress site with gzip compression

Step 4: Right click your .htaccess file

Speed up your wordpress site with gzip compression

Speed up your wordpress site with gzip compression

Step 5: Click “Download” and save a backup of your file

Speed up your wordpress site with gzip compression

Step 6: Right click Your .htaccess file again, this time click “Edit”

Speed up your wordpress site with gzip compression

Step 7: If this pop-up appears, click “Edit”

Speed up your wordpress site with gzip compression

Step 8: Copy this code

# Gzip Start
<IfModulemod_gzip.c>
mod_gzip_onYes
mod_gzip_dechunkYes
mod_gzip_item_includefile.(html?|txt|css|js|php|pl)$
mod_gzip_item_includehandler^cgi-script$
mod_gzip_item_includemime^text/.*
mod_gzip_item_includemime^application/x-javascript.*
mod_gzip_item_excludemime^image/.*
mod_gzip_item_excluderspheader^Content-Encoding:.*gzip.*
</IfModule>
# Gzip End

Step 9: Paste it to the bottom of your .htaccess file

Speed up your wordpress site with gzip compression

Step 10: Click “Save Changes”

You can run the gzip/brotli test again here. If the test does not recognize the compression, you can either wait a few hours and try again, or purge your website cache.

Now that you know how to speed up your WordPress site with gzip, why not sign up for our newsletter to get more tips every week?