利用浏览器缓存 - 未设置到期日期

Leverage browser caching - expiry dates are not being set

我正在使用 https://developers.google.com/speed/pagespeed/insights/,它显示我网站上的每张图片都没有被缓存。我试过使用 W3 Total Cache,用这个编辑 .htaccess:

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

还有这个:

<filesMatch ".(ico|pdf|flv|jpg|svg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=84600, public"
</filesMatch> 

代码,但无济于事。 为什么图像没有被缓存?有办法解决这个问题吗?

PageSpeedlink:https://developers.google.com/speed/pagespeed/insights/?url=darbas.pcz.lt

提前致谢!

您需要在单词中添加 plus 才能使其生效,

否则你说的 expires when its accessed one month。这毫无意义。

ExpiresActive On
ExpiresDefault "access plus 14 days"
ExpiresByType application/javascript "access plus 30 days"
ExpiresByType text/css "access plus 30 days"
ExpiresByType application/x-httpd-php "access plus 30 seconds"