Jump to content

Compression for modern websites

Recommended Posts

Hi folks.

Would appreciate your insight. A few years ago I added the following lines of code to the first lines of all my PHP/Xhtml Transitional based web pages (nothing to do with IPS Suite).

ob_start( 'ob_gzhandler' );

I also renamed by CSS sheets to end in php file extention and added these lines of code to them, so that they would be gzipped as well:

ob_start ("ob_gzhandler");
header("Content-type: text/css; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " . 
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";


These 2 actions gave some great compression and speed reduction results on my websites. Due to increasing work commitments, I haven't been able to keep up to date with web design/development as I used to, and I'm catching up. Is this still the best way to do it? Or has it been superseded by newer best practice methods like using .htacess?

Many thanks.



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...