is there any problem with just adding this cache control (below). and then waiting to see if it helps or hurts and then add more cache control directives in a modular fashion?
#
<FilesMatch "\.(gif夸pe?g如ng圭ss夸s夷co如df存wf圩lv)$">
ExpiresDefault A604800
Header set cache-control: "no-cache, public, must-revalidate"
</FilesMatch>
#
also what would be the equivalent syntax for adding the cache control above to the html headers instead of in the htaccess? for example using meta tags, or ?...
thank you
Also, consider whether you really need to revalidate those media filetypes. Doing so means that the browser will send an If-Modified-Since request to your server every time, and that (in most cases) your server will (have to) respond with a 304-Not Modified status response. It's usually better to simply mark those filetypes with a Expires header and leave the Cache-Control header blank (unset). Then if you need to 'override' a previously-cached object on an emergency basis, it's usually far more efficient to simply re-name it on the server, thus avoiding any need for page-load-by-page-load revalidation of included objects that almost never change.
There's no problem with using your 'modular' approach. You'll see the most gain right from the start with the filetypes you've listed, since images are requested most often and can be large, and the others you've listed, although perhaps not requested as often, can be even larger (e.g. the .pdf and .flv files). The benefit for each object type can be approximated as the number of requests per unit time multiplied by the filesize, and that's the order you should list them in.
Jim
Conversely, if I don't update any of those types of files, will the cache retain the files until the time (A604800) expires and then re-access the files?
Basically what I am trying to accomplish is to speed up the browsing experience by caching certain files that change somewhat infrequently, but not have to change the file name if I make any updates...
It is unusual for images to change once published. Most are "pictures" or "paintings" or "photos" or "logos." But if you have images that change because they contain, for example, data rendered into visual form, and you do not wish to change the image name when the data has changed and a new image is rendered, then I suggest you segregate your images into two groups: those that don't change or whose filenames can be updated if the images change, and those which are dynamically-generated and whose filenames cannot change. Then put these two groups into different directories or directory-structures. You can then put two different cache-control policies into effect by putting two different .htaccess files at the top of these two directory branches.
For regular images, just send an Expires header, setting it to a week or two. For the images that change frequently, set the expires-after time to one-half of your average update frequency, and set no-cache and must-revalidate in the Cache-Control header.
That's all that is needed: a long-term Expires header with no Cache-Control header at all for unchanging images, and a shorter-term Expires header plus "no-cache, must-revalidate" for the images that you do expect to change.
If you dig into the specs (RFC2616), you'll find that "public" and "no-cache" don't mean what you might think they mean. The only way to make sense of all this is to read and understand the protocol specifications.
Jim