Portal Home > Knowledgebase > Your Control Panel > How to enable gZIP compression for your pages?


How to enable gZIP compression for your pages?




HTTP compression uses standards-based gzip and deflate compression algorithms to compress your XHTML, CSS, and JavaScript to speed up web page downloads and save bandwidth.

How to enable gZIP compression for your pages?
Method 1

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.whatsmyip.org/http_compression/

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.

 

Method 2

Login to cPanel account for the user account which GZIP compression wants to be turned on. Then click on Optimize Website under Software / Services.User will be presented with options to compress all content or compress the specified MIME types, with a text box to specify file types to compress is selected (default is text/html text/plain text/xml). Choose either one setting to enable GZIP compression on all websites hosted by the particular account. Click on Update Settings when done.

 

 

 



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
CPanel User Manual (Views: 3992)

Powered by WHMCompleteSolution