⇒ http://my.opera.com/tech-nova/blog/
Un site qui recense les astuces et évolutions des possibilités de SPIP.
Optimizing your SPIP server
Février 2008, Par tech-novaIt’s in fact usefull for every website.
Here is what I do :
- Expires header and Etag :
I add this to http.conf :
# cache
ExpiresActive On
ExpiresDefault A300
ExpiresByType image/x-icon A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType text/plain A604800
ExpiresByType application/x-shockwave-flash A604800
ExpiresByType video/x-flv A604800
ExpiresByType application/pdf A604800
ExpiresByType text/html A300
# Etags est mal calcule, donc
FileETag MTime Size
- Compression :
I use a custom .htaccess combined with php (in squelettes/css) :
AddHandler application/x-httpd-php .css
php_value auto_prepend_file gzip-css.php
php_flag zlib.output_compression On
the code of gzip-css.php :
< ?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) ;
?>
I do the same operation for javascript files (I change the header to « application/x-javascript » of course)
- I compact every CSS files in one file by using the same code of dist/squery.js.html
(of course only for one media ;)
#CACHE3600*100,cache-client
#HTTP_HEADERContent-Type : text/css ; charset=iso-8859-15
#HTTP_HEADERVary : Accept-Encoding
#INCLUREcss/zero.js
#INCLUREcss/typo.js
#INCLUREcss/forums.js
#INCLUREcss/documents.js
#INCLUREhabillage.css
#INCLUREspip-style.css
What optimisations do you practice ?
→ Lire la suite sur le site d’origine…
