How to enable gZIP compression for your pages?

 August 27, 2011     0 Comments

The gZIP compression of your files improves the performance of your website and highly decreases its loading time. For complex websites it is highly recommended to enable it. 

Some applications have internal support to compress their pages. For example, in Joomla you can turn on the gZIP compression from Global Configuration > Server > gZIP Page Compression set to ON.

You can test whether the compression is working by using this useful tool -

If you are not using a web application that has internal methods for enabling the compression, you can add the following line at the top of your php files:

<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>

Basically, the user makes a request for your website, the server compresses your page (this significantly reduces its size) and transfers it to the customer's computer. On the visitor's end the file is being decompressed and visualized. The time needed for file compression is much less than the time to transfer a big file over the Internet.

How helpful was this article to you?

Powered by

FraudLabs Pro Secured Seal