Cache expires not applying to some images in Wordpress

admin

Administrator
Staff member
I defined cache expires for my Wordpress but SpeedTest still tells me I should fix it for some jpg and png images.

I have <a href="https://wordpress.org/plugins/cache-enabler/" rel="nofollow noreferrer">Cache Enabler</a> plugin installed and added the following to my .htaccess:

Code:
&lt;IfModule mod_expires.c&gt;
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType image/x-icon "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 604800 seconds"
  ExpiresByType text/javascript "access plus 216000 seconds"
  ExpiresByType application/x-javascript "access plus 216000 seconds"
  ExpiresByType text/html "access plus 600 seconds"
  ExpiresByType application/xhtml+xml "access plus 600 seconds"
&lt;/IfModule&gt;

&lt;IfModule mod_headers.c&gt;
 &lt;filesMatch ".(ico|pdf|flv|jpg|svg|jpeg|png|gif|js|css|swf)$"&gt;
 Header set Cache-Control "max-age=84600, public"
 &lt;/filesMatch&gt;
&lt;FilesMatch "\\.(css)$"&gt;
Header set Cache-Control "max-age=2692000, public"
&lt;/FilesMatch&gt;
&lt;FilesMatch "\\.(js)$"&gt;
Header set Cache-Control "max-age=216000, private"
&lt;/FilesMatch&gt;
&lt;FilesMatch "\\.(x?html?|php)$"&gt;
Header set Cache-Control "max-age=600, private, must-revalidate"
&lt;/FilesMatch&gt;

Header unset ETag
Header unset Last-Modified

&lt;/IfModule&gt;

I also tried to follow <a href="https://stackoverflow.com/questions/2508783/add-expires-headers-for-specific-images">these instructions</a> but still no luck.

Is there a particular reason why these images won't have their cache expiration defined?

All images are on my server by the way, most of them on the folders:

wp-content/uploads/cache/

wp-content/themes/Wordpress/images/