Why Serve Compressed Content?
The most pertinent answer to this particular question is that HTML can be compressed by up to 70%. This will be of particular benefit for large pages that consist of a lot of data, it will speed up the process of downloading the page, provide a better user experience, save on bandwidth and it is universally supported as well.
Google previously made an announcement that "Page Speed is now a ranking factor", although this might not have been ground breaking news amongst the SEO community, it was important because it stated that Google wants to use usability metrics to aid in ranking pages. A fast loading site should be a priority as slow sites diminish customer satisfaction and research has demonstrated that an increase in site speed can improve conversions, a metric all webmasters strive for.
What we keep coming back to is that all the major search engines want to give users a great user experience and it is well documented that a fast site increases overall site quality and boosts user satisfaction. It is accepted amongst the top three major search engines being Google, Bing and Yahoo that all users should have a fast browsing experience.
To explain the process, when a visitor lands on a site a request is sent through the web browser to the web server, which seeks to find the page requested. On finding the page, the web server responds and sends the page data back to the browser. However, the problem arises when this data is large say 100KB, this is a lot of data and this can take some time to send. The solution is to zip it, the same process occurs but, when the data is zipped it can be is reduced typically by 70%. The web browser on receiving the data unzips the data and displays the page.
The technical details that have to be dealt with is ensuring that the browser and server are both in agreement that it is OK to send compressed data. This is dealt with in two parts:
- The browser assigns a header informing the server it welcomes compressed content. Accept-Encoding: gzip, deflate
- The server assigns a response if the content is really compressed. Encoding: gzip
If the server fails to assign the content-encoding response header, it results in the file not being compressed, which, is the default on many servers. If the server chooses not to send back compressed content, the browser has to settle for the bulky regular version. The browser will either assign the Accept-Encoding: gzip, deflate header or it won't. What webmasters are responsible for is the configuration of the sever so that it sends zipped content if the browser can deal with it thereby, preserving bandwidth for everyone. Faster bandwidth equals a happy visitor.
Enable compression on Apache Web Server
To enable compression on Apache web servers the following 2 modules need to be compiled and enabled.
GZIP can then be enabled by adding the following lines to the httpd.conf file:
If access to the httpd.conf file is restricted the same can be achieved by adding the following lines to the .htaccess file:
Enable compression on NGINX Web Server
To enable GZIP compression on NGINX the following lines should be added to the /etc/nginx/ngnix.conf file:
Enable compression on IIS Web Server
Enabling compression on Microsoft's IIS web server is fully documented on their Technet website and can be found here
Once you have dealt with the compression issue you will need to authenticate your compression, and ensure that you are actually handing over compressed content, this can be achieved by signing up to one of our free or paid plans and testing your website
Implementing compression is one of the quickest ways to enhance a websites performance. So don't delay in carrying out the relevant procedures and have your visitors reap the benefits.