Implement cache management using .htaccess on Apache server

Okay, I'm still trying to get some of the caching, and I looked through some examples that I could find on Google. I added the following code to the .htaccess file:

### activate mod_expires ExpiresActive On ### Expire .gif 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 it's caching some of my images / files, but not all of them. I still have a list of files (.jpg, .js and .css - I know that I did not install cache files here) that are not cached. The Chrome revision message simply states The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers: 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 are not caching are background images, others are part of the js gallery and called via JS - can this affect why they are not cached?

Sorry, I canโ€™t give a link to the code - sites that are still under covers and are limited only by the presentation of the client.

Thanks in advance!

+6
apache .htaccess cache-control
source share
1 answer

It looks like you spelled MIME types incorrectly:

 # 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" 
+9
source share

All Articles