Reputation: 23
I'm using https://developers.google.com/speed/pagespeed/insights/ and it shows that every image on my site is not being cached. I've tried using W3 Total Cache, editing .htaccess with this:
## 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 ##
And this:
<filesMatch ".(ico|pdf|flv|jpg|svg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=84600, public"
</filesMatch>
Code, but to no avail. Why are the images not being cached? Is there a way to fix this?
The link to PageSpeed: https://developers.google.com/speed/pagespeed/insights/?url=darbas.pcz.lt
Thank you in advance!
Upvotes: 1
Views: 662
Reputation: 2168
You need to add in the word plus
to make it work,
otherwise your saying it expires when its accessed one month
. which makes no sense.
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"
Upvotes: 1