How To Enable GZIP Compression In WordPress
Learn How can you fix Warning of Enable GZIP Compression In WordPress . You may get this warning on gtmetrix , pindom tool , or google pagespeed Tool . Gzip Compression is very helpful in increasing website speed Before i start explaining How can fix the error lets have some basic information about gzip compression
What is GZIP Compression?
Gzip comes from word G+ZIP . G means GNU and Zip means Compressing . Here Gnu is a company name . Gzip is a format used for compression and decompression . Decreasing the page size is quite difficult for any website . But you can decrease the website by compressing it using gzip .
How Does Gzip Compression Work and why we should use it ?
How to Enable Gzip Compression?
You can enable compression via 2 Methods. In both the case you will get almost same result .
1. Plugin Method
#1 Enable GZIP compression plugin
You need to Install and activate the plugin . Once you activate the plugin that code will automatically get added to your .htacess file .
#2 W3 Total Cache Plugin
You need to follow the path for enabling the compression in W3 Total Cache – Browser cache >>>> enable HTTP (GZIP compression ) and check that option.
#3 WP Super Cache plugin
You need to follow the path for enabling the compression in WP Super Cache – Advance >>>> Miscellaneous >>>>> compress pages so that ….. check that option.
#4 WP Fastest Cache
For wp fastest cache user you just need click on settings tab . Under that you will gzip (Reduce the size of file sent from the server ) Just check that option and you are done .
Using Wp-rocket you can achieve all the functions easily like magnification of html, css, and js files . Apart from that it has many functions to make it possible for your website to get 100/100 in website loading tools .
#6 Comet Cache – In case of Comet Cache plugins you need move under Apache optimization . Inside that select “Yes enable gzip Compression ( Recommanded ) ” and now you are done .
2. Without Plugin Method
How to Fix “Enable Gzip compression” warning using .htaccess (Apache server)
You need to paste the below mention code to your .htacess file this will enable gzip compression on your WordPress file. The below code is valid for all kinds of plugins like comet cache , wp-rocket and fastest cache
# 1.BEGIN Gzip Gomahamaya
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
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/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/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 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
# END Gzip Gomahamaya
Finally your code in .htacess should looks like this
Enable GZIP on NGINX
You need to add it to your NGINX server config file
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
Why gzip compression is not working In my website ?
- You need to Understand one simple concept that whatever the content you are not hosting inside your server, you can’t compress it .
- If still you think code its not working then you need to enable mod_deflate on my server .Its better contact your hosting providers .