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.
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.
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):
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
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/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 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
- 3- If you are using IIS server then please Check this link
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.