CDS-Invenio: compress CSS to speed up page load
Some days ago I discovered PageSpeed plugin for Firebug. This plugin is really useful to speed up your CDSInvenio website load time.
In this brief post I’ll be describing how to compress CSS with GZIP to speed up page load.
It is really simple.
1. Your server must be able to execute PHP.
2. Edit etc/apache/invenio-apache-vhost.conf. Locate this lines:
<Directory /soft/cds-invenio/var/www> AddHandler python-program .py .cgi
And change them to:
<Directory /soft/cds-invenio/var/www> AddHandler application/x-httpd-php52 .css AddHandler python-program .py .cgi
3. Edit your CSS files (var/www/img/*.css) and add these lines to the begining:
<?php ob_start ("ob_gzhandler"); header("Content-type: text/css; charset: UTF-8"); header("Cache-Control: must-revalidate"); $offset = 60 * 60 ; $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; header($ExpStr); ?>
4. Restart your server:
/etc/init.d/httpd restart
Related posts:
- CDS-Invenio: CSS Sprites to speed up page load
- CDS-Invenio: CSS + JS combining and compression to speed up page load
- CDS Invenio: Internet Explorer 8, https, css and images not loading [SOLVED]
- CDS Invenio: replicate software in another server (development server)
- CDS-Invenio: [notice] mod_python: (Re)importing module ‘mod_python.publisher’