Question

okay, I'm still trying to get my head around some of the caching stuff and I have gone through a couple of examples I could find on Google. I have added the following code to my .htaccess file:

### activate mod_expires
ExpiresActive On
### Expire .gif's 1 month from when they're accessed
ExpiresByType image/gif "access plus 3 months"
ExpiresByType image/png "access plus 3 months"
ExpiresByType image/jpg "access plus 3 months"
ExpiresByType text/javascript "access plus 3 months"

Using the Chrome audit tools and the YSlow Firebug tool, it looks like this is caching some of my images/files, but not by far all of them. I still have a list of files (.jpg, .js and .css - I know I've not set the css files to cache here) that aren't caching. The message in the Chrome audit simply states The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers:

some of the images that aren't caching are background images, others are part of a js gallery and they're being called via the JS - could that be affecting why they aren't caching?

Sorry I can't give a link to the code - the sites still under wraps and limited to client view only.

Thanks in advance!

Was it helpful?

Solution

It looks like you've written the MIME-types wrong:

# enable expirations
ExpiresActive On
ExpiresDefault "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/pjpeg "access plus 1 week"
ExpiresByType text/javascript "modification plus 1 week"
ExpiresByType application/javascript "modification plus 1 week"
ExpiresByType text/css "modification plus 1 week"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top