2013/7/29 Franck Paul <[email protected]> > Perso j'ai configuré ça dans le .htaccess de mon installation : > > # COMPRESS TEXT, HTML, JAVASCRIPT, CSS, XML > <IfModule mod_deflate.c> > AddOutputFilterByType DEFLATE text/plain > AddOutputFilterByType DEFLATE text/html > AddOutputFilterByType DEFLATE text/xml > AddOutputFilterByType DEFLATE text/css > AddOutputFilterByType DEFLATE text/x-component > AddOutputFilterByType DEFLATE application/xml > AddOutputFilterByType DEFLATE application/xhtml+xml > AddOutputFilterByType DEFLATE application/rss+xml > AddOutputFilterByType DEFLATE application/javascript > AddOutputFilterByType DEFLATE application/x-javascript > </IfModule> > > # Turn on Expires and set default expires to 1 day > ExpiresActive On > # ExpiresActive Off > ExpiresDefault "access plus 1 day" > > # Set up caching on font files for 1 month > <FilesMatch "\.(eot|svg|ttf|woff)$"> > ExpiresDefault "access plus 1 month" > Header append Cache-Control "public" > </FilesMatch> > > # Set up caching on media files for 1 week > <FilesMatch > "\.(ico|gif|jpg|jpeg|png|flv|pdf|swf|mov|mp3|wmv|ppt|m4v|avi)$"> > ExpiresDefault "access plus 1 week" > Header append Cache-Control "public" > </FilesMatch> > > # Set up 48 Hour caching on commonly updated files > <FilesMatch "\.(txt|html|js|css)$"> > ExpiresDefault "access plus 2 days" > Header append Cache-Control "public" > </FilesMatch> > > # Set up 1 Hour caching on frequently updated files > <FilesMatch "\.(xml|xsl)$"> > ExpiresDefault "access plus 1 hour" > Header append Cache-Control "public" > </FilesMatch> >
si notre script de build rajoutait un timestamp (basique) ou un hash (change avec le contenu du fichier donc plus évolué) aux noms des fichiers statiques, on pourrait mettre 1 an d'expiration sur tous les fichiers statiques.
-- Dev mailing list - [email protected] - http://ml.dotclear.org/listinfo/dev
