2

我已将以下代码添加到我的 .htaccess 中,但 PageSpeed Insights 仍显示 Leverage Browser Caching 建议。

<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access 1 month"
 ExpiresByType image/x-ico "access 1 year"
 ExpiresByType image/jpg "access 14 days"
 ExpiresByType image/jpeg "access 14 days"
 ExpiresByType image/gif "access 14 days"
 ExpiresByType text/html "access 2 day"
 ExpiresByType text/css "access 2 days"
 ExpiresByType image/png "access 1month"
 ExpiresByType text/x-javascript "access 1 month"  
 ExpiresByType application/javascript "access 1 month"  
 ExpiresByType application/x-javascript "access 1 month"
</IfModule>

尽管如此,PageSpeed Insights 仍然指出我应该将浏览器缓存用于以下方面:

http://assets.pinterest.com/images/PinExt.png (60 seconds)
https://assets.pinterest.com/js/pinit.js (60 seconds)
http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=60 (5 minutes)
http://1.gravatar.com/avatar/572ef8c1916a898c441306a0f75f883e?s=60&d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D60&r=G (5 minutes)
http://1.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=60 (5 minutes)
http://cdn.api.twitter.com/1/urls/count.json?url=http%3A%2F%2Fwww.mbaadmissiongurus.com%2Fsample-mba-sop&callback=twttr.receiveCount (13.6 minutes)
http://widgets.pinterest.com/v1/urls/count.json?url=http%3A%2F%2Fwww.mbaadmissiongurus.com%2Fsample-mba-sop&ref=http%3A%2F%2Fwww.mbaadmissiongurus.com%2Fsample-mba-sop&source=6&callback=PIN_1378214653068.f.callback[0] (14.8 minutes)
https://connect.facebook.net/en_US/all.js (20 minutes)
https://apis.google.com/js/plusone.js (30 minutes)
https://platform.twitter.com/widgets.js (30 minutes)
http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js (60 minutes)
http://pagead2.googlesyndication.com/pagead/osd.js (60 minutes)
https://oauth.googleusercontent.com/gadgets/js/core:rpc:shindig.random:shindig.sha1.js?c=2 (60 minutes)
https://platform.stumbleupon.com/1/widgets.js (2 hours)
https://platform.linkedin.com/in.js (3 hours)
https://s2.googleusercontent.com/s2/favicons?domain_url=ExportControls.com/e-seminars (8 hours)
https://s2.googleusercontent.com/s2/favicons?domain_url=healthcare-tataaig.com/Health-Cover (8 hours)
https://s2.googleusercontent.com/s2/favicons?domain_url=worldeducationfair.com (8 hours)
https://s2.googleusercontent.com/s2/favicons?domain_url=www.Dulux.in (8 hours)
https://s2.googleusercontent.com/s2/favicons?domain_url=www.asianpaintshomesolutions.com (8 hours)
https://s2.googleusercontent.com/s2/favicons?domain_url=www.principalretirementindia.com (8 hours)
4

1 回答 1

7

所有列出的资源似乎都是外部的。您通常无法为外部资源添加/修改标头和/或缓存行为,因此您无能为力。

只需确保您控制下的所有资源(来自您的服务器和/或 CDN)正确利用缓存。

于 2013-09-03T13:32:58.713 回答