ToutSurTout.biz
Optimiser le temps de réponse de votre site


Voici le code à placer dans votre .htaccess :

#================= Expiration ===================
ExpiresActive On
ExpiresDefault A2592000
ExpiresByType text/css A2592000
ExpiresByType text/html A2592000
ExpiresByType text/xml A2592000
ExpiresByType text/javascript A2592000
ExpiresByType image/png A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType image/icon A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType application/xhtml+xml A600
ExpiresByType application/x-shockwave-flash A2592000
ExpiresByType application/javascript A3592000
ExpiresByType application/x-javascript A3592000
#============= Compresse GZIP ==================
AddType image/x-icon .ico
AddType application/vnd.adobe.air-application-installer-package+zip .air
AddType application/x-shockwave-flash .swf
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/x-httpd-php
#============ Compress text files ==============
<ifModule mod_deflate.c>
<filesMatch "\.(css|js|x?html?|php)$">
SetOutputFilter DEFLATE
</filesMatch>
</ifModule>
#=========== Cache-Control Headers =============
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "max-age=216000, private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "max-age=600, private, must-revalidate"
</filesMatch>
</ifModule>
#============ Turn ETags Off ================
Header unset ETag
FileETag None

Pour vérifier le résultat allez sur ce site :

http://gtmetrix.com/

Faites un test avant et après la modification, cela devrait se ressentir.

De plus, Gtmetrix vous aide à optimiser les détails les plus flagrants.