I know that this bit of code:
<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>
will enable gzip. But, what is the correct way to apply this to all my Zend Frameworks View
s and Layout
s?
Instead of gzipping from PHP (which means only your HTML generated content will be compressed), you could ask Apache to compress for you -- using its mod_deflate
module.
Great advantage : it'll allow your server to compress HTML, of course... But also JS and CSS ; which means a huge gain for the users who have to download those when visiting your site.
Note : if you are not using Apache, other web-servers have equivalents of mod_deflate
;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With