Are you looking for Responsive website development with SEO?

I am senior Freelance Web Designer in Kuala Lumpur, Malaysia with over 15 years of experience. Hire experienced & Best Website Design Services in affordable prices.

Learn More

Why we need to optimize website with GZIP compression?

website-GZIP-compression

What is GZIP Compression? Why we need to optimize website with GZIP compression?

Website Compression is powerful way to save bandwidth and speed up your website. After launching my websites, when one day I had tested my website on Google Insight then I realized my website loading time was not up to the mark according to Google requirements. Google test reports recommended me to use GZIP compression to speed up my website loading time.

What is GZIP Compression?

I would like to explain first about what is content encoding?. When you request to browse a website for example ( www.klfreelancedesigner.com/index.html ) your browser talks to a web server. The conversation goes a little like this:

  • Browser: Hello, Browse me /index.html
  • Server: Ok, let me find if index.html is hosted on server…
  • Server: Found it! Here’s your required code (350 OK) and I’m sending the file.
  • Browser: 350KB? OMG, Heavy file… loading…loading… ok, it’s loaded.

So like this you get your required web file on browser. The heavier file you have, the more loading time it will require to show you on your browser. In 350KB file there would be a lot of HTML codes, CSS files, and Javascripts codes. So we need to ZIP the file on our server after receiving the request from browser. When browser will receive the compress file from server, it will extract it and will display the file quickly which will save your bandwidth and loading time. All this process called GZIP compression.

Google and Yahoo use GZIP compression. A modern browser is needed to enjoy modern web content and modern web speed, so GZIP encoding will help you to improve your website SEO.

How to check my website server has GZIP enabled or not?

Once you uploaded your website on your server you can check first your website on Google Insight tools, if your website is heavy and your webserver GZIP is disabled you will see in the result. There are some other 3rd party Tools where you can check your website GZIP status.

1- https://www.giftofspeed.com/gzip-test/
2- https://varvy.com/tools/gzip/

gzip-compression

What should I do, if my web server GZIP is not enabled ?

After testing if you found that your server GZIP is not enabled, you can do make it enable by using 2 methods.

  • Check with your hosting server and asked them to enable your GZIP service on your hosting server.
  • If you are using Linux server, you can add these codes in your .htaccess file which will be in your root folder.

To enable mod_deflate(recommended):

<IfModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE text/javascript

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE image/x-icon

AddOutputFilterByType DEFLATE image/svg+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/x-font

AddOutputFilterByType DEFLATE application/x-font-truetype

AddOutputFilterByType DEFLATE application/x-font-ttf

AddOutputFilterByType DEFLATE application/x-font-otf

AddOutputFilterByType DEFLATE application/x-font-opentype

AddOutputFilterByType DEFLATE application/vnd.ms-fontobject

AddOutputFilterByType DEFLATE font/ttf

AddOutputFilterByType DEFLATE font/otf

AddOutputFilterByType DEFLATE font/opentype

# For Olders Browsers Which Can’t Handle Compression

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

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

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

</IfModule>

After enabling the GZIP compression on your server, please test your website by using above mentioned tools. Enabling compression is one of the fastest ways to improve your site’s performance as well as it will help you to improve your SEO ranking.

Please leave a reply