Sunday, 4 March 2018

How To Optimize Your Site With GZIP Compression?


              In this article, we shall learn how to  Optimize Your Site With GZIP Compression.

GZIP Compression is a simple, effective way to save bandwidth and speed up your site.

GZIP Compression is a technique supported by most web browsers and web servers.
When enabled on both sides, it can automatically reduce the size of text downloads (including HTML, CSS and JS) by 55-85%. It is enabled by default on all modern browsers, however all web servers disable it by default, and it has to be explicitly enabled.

Write below code in your web site ".htaccess" file.

<IfModule mod_gzip.c> 
mod_gzip_on       Yes 
mod_gzip_dechunk  Yes 
mod_gzip_item_include file      .(html?|txt|css|js|php|pl)$ 
mod_gzip_item_include handler   ^cgi-script$ 
mod_gzip_item_include mime      ^text/.* 
mod_gzip_item_include mime      ^application/x-javascript.* 
mod_gzip_item_exclude mime      ^image/.* 
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

Feel free to download the source code.

Hope you liked this article, do share to your friends, colleagues and social websites.

No comments:

Post a Comment