How To Enable GZIP Compression In WordPress
Learn How can you fix the 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 me have some basic information about gzip compression
What is GZIP Compression?
Gzip comes from the 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 cases, you will get almost the 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 the wp fastest cache user you just need to click on the settings tab. Under that, you will gzip (Reduce the size of the file sent from the server ) Just check that option, and you are done.
Using Wp-rocket you can achieve all the functions easily like a 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 the case of Comet Cache plugins you need to move under Apache optimization. Inside that select “Yes enable gzip Compression ( Recommended ) ” 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 look 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 On 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 the code is not working then you need to enable mod_deflate on my server. It’s better to contact your hosting providers.