How-To

How to Enable GZIP Compression on Hosted WordPress Site

Know How-To enable GZIP Compression and speed up your WordPress Site.

How to Enable GZIP Compression on Hosted WordPress Site

Welcome back, here we are again. From last few days we were trying to set up our own website to provide services to other people. For this purpose and keeping in mind the thing that we all were novices in this world of Internet we thought of keeping it simple for us to manage website and chose WordPress as our go to platform.

WordPress if you don’t know is a CMS platform, which stands for “Content Management System”. It simply allows you to set up your own website with a domain (Your Digital Identity) without having knowledge of coding. Due to WordPress many artist and people from different backgrounds having no knowledge of coding were able to set up their own website and share their vast knowledge with the people over internet. This helped many people to learn new skills, grow their network and also businesses.

Today we are going to apply GZIP compression to data on our WordPress site. Know that this compression cannot be done with the help of any plugins which can be installed on the WordPress, this requires you to access a particular file from the server and edit It to enable the compression to take effect.

  • What is Compression?

Compression is simply, reducing the size of data. It has many advantages and few disadvantages. But it’s always a good choice to compress your data on server for faster transmission, lower bandwidth use and easy accessibility.

  • What is GZIP Compression?

GZIP Compression is a technique to reduce the file size on your server for faster transfer over the network. It allows your webpages to load quickly on viewport of the visitor. It’s a wise choice to have GZIP Enabled on your site.

  • How to Enable GZIP Compression?

Steps:

We are using Hostgator as our hosting provider so we will use it as example to show you how to enable GZIP Compression by accessing the .htaccess file from the file explorer.

  1. First of all go to your cPanle and open the File Explorer by clicking on it.

How to Enable GZIP Compression on Hosted WordPress Site

 

2.  After accessing your files through cPanel you’ll need to enable an option to show hidden files.

For this go to Top Right Corner and select Settings. In this tick the box next to “Show Hidden Files (dotfiles)”.

How to Enable GZIP Compression on Hosted WordPress Site

 

3. Now on left hand side look for folder named “public_html”, click on it to view it in expanded form on the right window. Here you’ll find your file named “.htaccess”.

How to Enable GZIP Compression on Hosted WordPress Site

4. Now go to the file and download a copy of it as a backup before making any changes to it. Do so by right clicking on it and choosing the option download.

5.  After you’ve downloaded the file, again right click on it and choose “Edit” option. Here you’ll be prompted to backup the file and then proceed. At this point just click on Edit option and proceed next.

Now you’ll be taken to another tab to edit the file.

Here copy the following code into the window just above the last sentence named “#END WordPress”.

Code:

<IfModule mod_deflate.c>

# Compress HTML, CSS, JavaScript, Text, XML and fonts

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




# Remove browser bugs (only needed for really old browsers)

BrowserMatch ^Mozilla/4 gzip-only-text/html

BrowserMatch ^Mozilla/4\.0[678] no-gzip

BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

Header append Vary User-Agent

</IfModule>

(Source Code Taken from Internet)

6. Now click on the top right tab of “Save Changes” and then click “Close”.

Here you’ve successfully enabled GZIP compression on your site. To check if its enabled or not, visit Check GZIP Compression and enter your URL to check the status.

7. Success!

(Note: Here we are using HostGator as our hosting provider, but you can follow similar steps if you are using different service. Just remember to backup your file before making any modifications, so in case of damage you can always replace modified file with backup one.)

Thank You for following the tutorial and stay tuned for future updates.

Like us on Facebook Page to get connected with us.

 

Ralco

Ralco

Founder at Design The Idea
Just another guy with a question in my head about purpose of my life !

Leave a Response