How to enable Gzip Output Compression using Mod Deflate in WordPress for minimising website load time, increase speed & performance, WordPress Performance Tip

If you want to increase your website’s performance & speed by reducing website’s load time on client’s i.e. visitor’s machine then this tutorial will help you.

 

Something About WordPress: WordPress on its own does not offer a mechanism to compress the blog’s HTML output. This normally is a feature provided by the Apache enabled web server.

 

As Apache Website Defines: The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.

 
Here is how to enable gzip compression via .htaccess

 
If you prefer to enable or fine tune output compression with the apache server, then copy paste below code in your .htaccess file:

 

<IfModule mod_deflate.c>
# Insert filters
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
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml

# Drop problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

 

Yes, Now you have enabled gzip compression for your website but how to know it is working or not?

 
Go to & Visit This Website to check: Check GZIP compression

 
Check GZIP compression

 
Hope it helps,

 
Thanks & Regards
Mandar Apte

Leave a Reply

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