Posts: 3
Threads: 1
Joined: Apr 2010
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();
Posts: 3
Threads: 1
Joined: Apr 2010
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:i", 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" />
Posts: 972
Threads: 27
Joined: Aug 2009
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.