Skip to the content
sistrall.it
February 29, 2004

A ristretto, please!

Hey, this post is vintage content. It dates back more than 22 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

Newsletter

Inserisci il tuo indirizzo email per iscriverti alla newsletter e ricevere notifiche occasionali di nuove foto e nuovi articoli via email. No spam, I promise. — Powered by MailChimp

I am Silvano Stralla. I am a developer, I like taking photos and riding bikes.
If you want, you can write to me at silvano.stralla at sistrall.it.
This site is handmade, with love, in Turin (Italy).

© 2002—2026 Silvano Stralla

To the top

This page was built on Mon, 13 Apr 2026 20:20:58 GMT from code version 63992562.