In my website I have the expires headers settings reported below. When I use Google's PageSpeed Insights test I get the message: XYZ.png expire headers not set, which I'm getting for all the PNG files in the WordPress theme I'm using.

It looks to me like PNG expires headers are already set in the .htaccess file, but I'm still getting this error/warning.

<IfModule mod_mime.c>
    AddType image/png .png
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/png A31536000

Does anyone know how I might be able to set the PNG expires headers correctly?

  • If you examine the HTTP response headers yourself, what do you see? – MrWhite Oct 13 '14 at 9:23
  • Is mod_expires enabled? On my Ubuntu/Debian system I can run sudo a2enmod expires to enable it. – Stephen Ostermiller Oct 28 '14 at 13:36
  • 1
    I also prefer to use "access plus 8 hours" rather than A31536000 because it is so much more readable. – Stephen Ostermiller Oct 28 '14 at 13:41
  • A31536000 == access plus 1 year – MrWhite Sep 14 '15 at 23:07
  • I had a curious issue where if I had a comment (preceded by a hash symbol) on the same line, it would cause an error 500. Make sure comments are on their own line – kurdtpage Jan 24 '18 at 19:45

Your Answer

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

Browse other questions tagged or ask your own question.