2014-10-24 12 views
14

PageSpeed ​​जानकारी में मैं लाभ उठाने के लिए मैं उपयोग कर रहा हूँ एक विशेष iconset/font के ब्राउज़र कैशिंग संदेश दिखाई दे रहा रखना: (2 दिन) iconFont.woffमैं .woff फोंट के ब्राउज़र कैशिंग का लाभ कैसे उठा सकता हूं?

मैं के रूप में तो मेरे .htaccess निर्धारित किया है:

## 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 ## 

इसके बावजूद मुझे अभी भी पेजस्पेड अंतर्दृष्टि में एक ही संदेश मिल रहा है। मैं इसे ठीक से कैश कैसे करूं?

+1

शायद फॉन्ट/WOFF काम नहीं कर रहा है, इस प्रयास करें: http://stackoverflow.com/questions/3594823/mime-type-for-woff-fonts?rq=1 –

उत्तर

47

यह मेरे लिए काम कर रहा है, क्योंकि Google पेज की गति अब इसे ठीक करने के लिए नहीं कह रही है। AddType आवश्यक है।

# 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

यह एक चाल है। सही – autarq

+0

के रूप में चिह्नित किया जाना चाहिए हैलो मैंने इसे .htaccess में जोड़ने का प्रयास किया, लेकिन जब मैं साइट को लोड करने के बाद साइट को लोड करता हूं तो "500" आंतरिक सर्वर त्रुटि दिखा रहा था। –

+0

@NileshKumar ऊपर समाप्त होता है ExiresActive पर और अंतिम पंक्ति के बाद, यह आपकी त्रुटि को ठीक करेगा –

संबंधित मुद्दे

 संबंधित मुद्दे