Enabling Gzip compression in delivering your webpage will improve your sites performance. If you used Yii PHP Framework in developing your website, you only need two lines of code to enable Gzip compression.

In your main.php configuration file, just add the following code:

//GZIP compress   
'onBeginRequest'=>create_function('$event', 'return ob_start("ob_gzhandler");'),
'onEndRequest'=>create_function('$event', 'return ob_end_flush();'),

Now, if you are using Google's PageSpeed Insight to get optimization suggestion for your website, it might still be saying that your page needs to enable compression. As per Google's PageSpeed Insights FAQ:

PageSpeed Insights' results are based on headers that were actually returned to your client, so if you are running the analysis on a client machine that is using such anti-virus software, or that sits behind an intermediate proxy server (many proxies are transparent, and you may not even be aware of a proxy intervening between your client and web server), they may be the cause of this issue.

You can use PageSpeed Insights Chrome extension to verify as suggested from PageSpeed Insights FAQ.

Posted in: Yii

Related FAQ's

Marius Ion ANGEL HOT SOFT LLC (800) 316-7677