Skip to the content
sistrall.it
February 29, 2004

A ristretto, please!

Hey, this post is vintage content. It dates back more than 20 years ago: it may contain outdated and inaccurate information.

If, as of this evening, sistrall seems a little more lively, it is thanks to the magic of PHP: a simple instruction at the head of each file is enough to compress the pages before sending them:

ob_start("ob_gzhandler");

That's it. And you can also do this at the beginning of style sheets (provided you specify the content-type correctly):

ob_start("ob_gzhandler");
header("Content-type: text/css");

And nothing forbids using the same method for scripts as well:

ob_start("ob_gzhandler");
header("Content-type: application/x-javascript");

To get the server to pass the pages to PHP before sending them, some small changes to the .htaccess file are needed. I have done this:

AddType application/x-httpd-php .html .css .js

The traffic generated by sistrall pages is more than halved in this way. Not bad, right?

Previous

Site navigation bar

February 19, 2004

Next

This page was built on Sun, 19 Jan 2025 08:56:48 GMT from code version 38bda9c8.