There are many simple things which improve the speed of your website. One of those things is gzip which make a website load faster. But gzip is not enabled by default on web host server. You have to do this yourself either from the control panel of web-hosting account or using a .htaccess file. It is very important to enable gzip because this one thing can improve the speed of your website as much as no other thing can do. So I thought I should share this information that how we can enable gzip?
What is gzip compression?
When a user visits your website the web browser makes requests to deliver files which are linked on that page.
The bigger these files are the longer it’s going to take for them to get to your browser and appear on the screen.
Gzip compresses your web pages and style sheets before sending them over to the browser. This drastically reduces transfer time since the files are much smaller.
In terms of cost versus benefit, gzip compression should be near the top of your page speed optimizations if you don’t have it setup already.
How does it work?
Gzip is actually a fairly simple idea that is extremely powerful when put to good use. Gzip locates similar strings within a text file and replaces those strings temporarily to make the overall file size smaller.
The reason gzip works so well in a web environment is that CSS and HTML files use a lot of repeated text and have loads of whitespace. Since gzip compresses common strings, this can reduce the size of pages and style sheets by up to 70%!
Gzip has to be enabled on your web server which is relatively straightforward.
When a browser visits a web server it checks to see if the server has gzip enabled and requests the webpage. If it’s enabled it receives the gzip file which is significantly smaller and if it isn’t, it still receives the page, only the uncompressed version which is much larger.
How to enable
There are different methods of setting up gzip compression depending on whether or not you’ve got an IIS or Apache server (or something else entirely).
If your server is IIS, follow these instructions in the Microsoft TechNet document to enable compression.
You will need to add the following lines to your .htaccess file: