Published on 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:


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

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

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

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?


Site navigation bar

February 19, 2004


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
This site is handmade, with love, in Turin (Italy).

© 2002—2024 Silvano Stralla

This page was built on Sun, 14 Jul 2024 05:13:35 GMT from code version a494c001.