How do I set expiration on CSS, JS and Images?
This is the one I use to fix the exact same thing when I ran the PageSpeed Addon:
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=604800, public"</FilesMatch>
This goes into your .htaccess file.
Read up on this page for more information about how to set cache for additional file types and/or change the cache length:
http://www.askapache.com/htaccess/apache-speed-cache-control.html
i would like to add this solution for those searching for it....
its also works great...using .htaccess
https://webmasters.stackexchange.com/a/5275/37765
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$"> ExpiresActive On ExpiresDefault A2592000 </FilesMatch>
What I do is to create a file "expires.conf" and include it in the site file configuration of Apache. You can include in .htaccess if you want.My expires:
<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>
You need to activate the expires module in apache.