1

When doing SEO tests, we consistently seeing a message for cache headers on images. We were thinking of implementing but cannot find the appropriate way to test this as the x-cache still gives a MISS.

Below is the htaccess file we have to accommodate for adding cache header for images.

How can I test to see the performance gain if I did this?

# One month
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
  Header set Cache-Control "max-age=2628000, public"
</filesMatch>
  • x-cache is really only useful for pages that hit PHP. What does developers.google.com/speed/pagespeed/insights say under Leverage browser caching for images? – mikeytown2 Nov 17 '17 at 18:29
  • @mikeytown2 under "Leverage browser caching for the following cacheable resources" it only mentions JS and CSS files, not images. I could not find a section that specifically says for images. – usernameabc Nov 20 '17 at 22:16
  • 1
    Then the cache header is working for images. x-cache does not measure the browser cache, only CDN or server level caches docs.fastly.com/guides/performance-tuning/… – mikeytown2 Nov 20 '17 at 23:48
0

Currenty working on that. The code

# One month
 <filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
  Header set Cache-Control "max-age=2628000, public"
 </filesMatch>

helped me to remove images from the list below https://developers.google.com/speed/

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.