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
February 19, 2004
Next
April 14, 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
sistrall.it.
This site is handmade, with love, in Turin (Italy).
© 2002—2024 Silvano Stralla
This page was built on Fri, 29 Nov 2024 09:34:20 GMT from code version 3b16ed79.