How to Enable GZIP Compression in WordPress website Hosted on Apache Server

How to Enable GZIP Compression in WordPress website Hosted on Apache Server

How to Enable GZIP Compression in WordPress website Hosted on Apache Server-: Do you want to improve the loading time of your WordPress website? Keep reading this post I will explain how to Boost Performance of your WordPress website using Gzip compression.

Compression allows your webserver to provide smaller file sizes which load faster for your website users. Enabling gzip compression is standard practice. If you are not using it for some reason, your webpages are likely slower than your competitors. 

How to Enable Gzip Compression in WordPress website Hosted on Apache Server-:

How to Enable GZIP Compression in WordPress website Hosted on Apache Server

Enabling GZIP compression for your WordPress site by editing your .htaccess file This is the most common way to enable WordPress GZIP compression. This is the most common way to enable WordPress GZIP compression it is strongly recommended from my side that takes backup of htaccess file before editing it.

The .htaccess file should be in the root folder of your website. This file, however, is usually hidden by default on both the remote server and your own machine.

Once you locate the .htaccess file, start editing it. Or, to be safe, download the file on your computer and first make changes on your own hard drive. The file is likely also hidden by default on your own machine, so force hidden files to show. Add the following code, sourced from GTmetrix, below the sections marked by the # BEGIN WordPress and # END WordPress tags.

Compress HTML, CSS, JavaScript, Text, XML and fonts using Gzip compression-:

AddOutputFilterByType DEFLATE application/javascript
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/x-javascript
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/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml

Save the file and use it to replace your original .htaccess file. Then, run your website through a GZIP compression checker tool (or verify the response headers) GZIP compression checker tool to make sure that you were successful.

Conclusion-: Gzip compression compresses file up to 70%. Increases the speed and have a high-cost benefit ratio. I recommend Every WordPress user to use Gzip compression on their website.

Thanks for reading…“Pardon my grammar, English is not my native tongue.”

If you like my work, Please Share on Social Media! You can Follow WP knol on Facebook, Twitter, Pinterest and YouTube for latest updates. You may Subscribe to WP Knol Newsletter to get latest updates via Email. You May also Continue Reading my Recent Posts Which Might Interest You.

About Amar Patel 263 Articles
Hi, I am Amar Patel from India. Founder, Author and Administrator of wpknol.com. I am a Simple Average Man who Loves life and Love living life.Professionally I am a Mechanical Engineer. Apart from my Job, I Love to write the things around WordPress WordPress CMS.