Knowledge Base Article

How to enable gZIP compression for your pages?

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 - http://www.gidnetwork.com/tools/gzip-test.php

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.



Rating

Please indicate if this article was helpful for you.

rating :  4.7 from 5
views :  1902
votes :  16

Haven't found what you are looking for? Suggest an article HERE.

powered by

Valid XHTML 1.0 Strict Valid CSS!