Modifichiamo il nostro file .htaccess andando ad aggiungere quanto segue per permettere al browser di memorizzare nella cache i segenti tipi di file: .gif, .png, jpeg, .ico, .js, .css, .swf .
<FilesMatch "\.(?i:gif|jpe?g|png|ico|css|js|swf)$"> <IfModule mod_headers.c> Header set Cache-Control "max-age=172800, public, must-revalidate" </IfModule> </FilesMatch>
oppure possiamo utilizzare anche:
<IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 10 days" ExpiresByType text/css "access plus 1 week" ExpiresByType text/plain "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType application/x-javascript "access plus 1 month" ExpiresByType application/javascript "access plus 1 week" ExpiresByType application/x-icon "access plus 1 year" </IfModule>