Reputation: 1046
I have cache control set by htaccess for all images by this
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A600
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
</IfModule>
It works great, but I have also pictures from web camera, which change every 20 minutes. So I need to cache all images except these from camera.
I can write regular expression for those from web camera, they have name which others pictures never can have. But how to put there some condition?
Upvotes: 1
Views: 880
Reputation: 784938
You can disable cache for certain matching files :
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A600
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
</IfModule>
# disable caching for IMG_20130420_535615.jpg type of files
<FilesMatch "IMG_[0-9]+_[0-9]+\.jpg$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Tue, 14 Jan 1975 01:00:00 GMT"
</ifModule>
</FilesMatch>
Upvotes: 1