我一直在尝试加速我们的网站并使用gtmertix.com进行检查。
我一直在添加/删除代码,并在htaccess文件中有这个。
我在.htaccess中设置了以下内容 -
# Leverage Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
<IfModule mod_headers.c>
<filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
Header set Cache-Control "max-age=2678400, public"
</filesmatch>
<filesmatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, private, must-revalidate"
</filesmatch>
<filesmatch "\.(pdf)$">
Header set Cache-Control "max-age=86400, public"
</filesmatch>
<filesmatch "\.(js)$">
Header set Cache-Control "max-age=2678400, private"
</filesmatch>
</IfModule>
但是当我查看gtmetrix.com
时,我仍会收到以下消息http://cdn-images.mailchimp.com/embedcode/horizontal-slim-10_7.css (expiration not specified)
http://downloads.mailchimp.com/js/goal.min.js (expiration not specified)
http://buttons-config.sharethis.com/js/58ac087b20428700112b0504.js (1 minute)
http://platform-api.sharethis.com/js/sharethis.js (10 minutes)
https://connect.facebook.net/en_US/fbevents.js (20 minutes)
https://connect.facebook.net/signals/config/247608415681348?v=2.7.10 (20 minutes)
https://google-analytics.com/analytics.js (2 hours)
如何为上述内容添加到期日期?还是不可能?