2014-10-24 15 views
14

In Speed ​​Insights continuo a vedere il messaggio di sfruttare il caching del browser di un particolare iconset/font sto usando: iconFont.woff (2 giorni)Come sfruttare il caching del browser per i caratteri .woff?

ho impostato il mio .htaccess come così:

## EXPIRES CACHING ## 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType font/ttf "access 1 week" 
ExpiresByType font/woff "access 1 week" 
ExpiresByType image/jpg "access 1 month" 
ExpiresByType image/jpeg "access 1 month" 
ExpiresByType image/gif "access 1 month" 
ExpiresByType image/png "access 1 month" 
ExpiresByType text/css "access 1 week" 
ExpiresByType application/pdf "access 1 month" 
ExpiresByType application/javascript "access 1 month" 
ExpiresByType application/x-shockwave-flash "access 1 month" 
ExpiresByType image/x-icon "access 1 year" 
ExpiresDefault "access 2 days" 
</IfModule> 
## EXPIRES CACHING ## 

Nonostante questo continuo a ricevere lo stesso messaggio in PageSpeed ​​Insights. Come faccio a memorizzarlo correttamente?

+1

Forse font/WOFF non funziona, provate questo: http://stackoverflow.com/questions/3594823/mime-type-for-woff-fonts?rq=1 –

risposta

47

Questo sta facendo il lavoro per me, poiché la velocità della pagina di Google non richiede più di risolverlo. AddType è essenziale.

# Fonts 
# Add correct content-type for fonts 
AddType application/vnd.ms-fontobject .eot 
AddType application/x-font-ttf .ttf 
AddType application/x-font-opentype .otf 
AddType application/x-font-woff .woff 
AddType image/svg+xml .svg 

# Compress compressible fonts 
# only uncomment if you dont have compression turned on already. Otherwise it will cause all other filestypes not to get compressed 
# AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml 

ExpiresActive on 

# Add a far future Expires header for fonts 
ExpiresByType application/vnd.ms-fontobject "access plus 1 year" 
ExpiresByType application/x-font-ttf "access plus 1 year" 
ExpiresByType application/x-font-opentype "access plus 1 year" 
ExpiresByType application/x-font-woff "access plus 1 year" 
ExpiresByType image/svg+xml "access plus 1 year" 
+0

Questo fa il trucco. Dovrebbe essere contrassegnato come corretto – autarq

+0

Ciao Ho provato ad aggiungere questo in .htaccess ma quando carico il sito dopo aver aggiunto questo sito mostrava errore server interno "500". –

+0

@NileshKumar Aggiungi sopra ExpiresActive on e dopo l'ultima riga, correggerà il tuo errore –

Problemi correlati