To enable GZIP COMPRESSION in WordPress using htaccess. Add the following code in your htaccess file located in WordPress root folder.

# BEGIN GZIP COMPRESSION
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
	 AddOutputFilterByType DEFLATE application/atom+xml
	 AddOutputFilterByType DEFLATE application/javascript
	 AddOutputFilterByType DEFLATE application/json
	 AddOutputFilterByType DEFLATE application/ld+json
	 AddOutputFilterByType DEFLATE application/manifest+json
	 AddOutputFilterByType DEFLATE application/rdf+xml
	 AddOutputFilterByType DEFLATE application/rss+xml
	 AddOutputFilterByType DEFLATE application/schema+json
	 AddOutputFilterByType DEFLATE application/vnd.geo+json
	 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/x-font-woff
	 AddOutputFilterByType DEFLATE application/x-javascript
	 AddOutputFilterByType DEFLATE application/xhtml+xml
	 AddOutputFilterByType DEFLATE application/xml
	 AddOutputFilterByType DEFLATE font/opentype
	 AddOutputFilterByType DEFLATE font/eot
	 AddOutputFilterByType DEFLATE font/otf
	 AddOutputFilterByType DEFLATE font/ttf
	 AddOutputFilterByType DEFLATE image/bmp
	 AddOutputFilterByType DEFLATE image/svg+xml
	 AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
	 AddOutputFilterByType DEFLATE image/x-icon
	 AddOutputFilterByType DEFLATE text/cache-manifest
	 AddOutputFilterByType DEFLATE text/css
	 AddOutputFilterByType DEFLATE text/html
	 AddOutputFilterByType DEFLATE text/javascript
	 AddOutputFilterByType DEFLATE text/plain
	 AddOutputFilterByType DEFLATE text/vcard
	 AddOutputFilterByType DEFLATE text/vnd.rim.location.xloc
	 AddOutputFilterByType DEFLATE text/vtt
	 AddOutputFilterByType DEFLATE text/x-component
	 AddOutputFilterByType DEFLATE text/x-cross-domain-policy
	 AddOutputFilterByType DEFLATE text/xml
</IfModule>
# END GZIP COMPRESSION

Have any doubt, then comment here!

Leave a Reply

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