Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compression
#1
Hi,

what do you think about add the following to the first line of index.php?

Code:
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
Reply
#2
We can do the same with css template:

- Rename default.css to default.css.php
- Add to top of this file:
Quote:<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
header ("content-type: text/css; charset: UTF-8");
header ("cache-control: must-revalidate");
$offset = 60 * 60;
$expire = "expires: " . gmdate ("D, d M Y H:iConfused", time() + $offset) . " GMT";
header ($expire);
?>
- Modify file template.php, on line 17 to:
Quote:<link rel="stylesheet" type="text/css" href="<?php get_theme_url(); ?>/default.css.php" media="all" />
Reply
#3
This should be possible by configuring your server to do the right thing, either by your hosting or by using a HTACCESS-file. That way you don’t have to change all your static files into PHP files and uploads (images etc.) will automatically be gzipped as well.

It would be something we could look into but I don’t think your solution is the solution.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply




Users browsing this thread: 1 Guest(s)