Caching using a htaccess file
I have a site that display a large number of small images (all gif files) and I want to write a htaccess file that I can use to instruct a browser to cache all images for a period of time.
The code within the htaccess file is:
I think the above code is correct but I am not sure if I place the file in the directory where all the gif images are located or in the root of the site.
Header set Cache-Control "max-age=604800, public"
Can anyone please advise.
From what I understand of htaccess files, placing it in the root is guaranteed to work (htaccess files are processed recursively, so it applies to ALL files and subdirectories).
I'm not sure if placing it in the images folder would work, BUT if it did it would do the same things as the first method since you've already written code to ONLY apply to gifs.
So, placing it in the root would be best, though just be sure you don't overwrite any current htaccess file.
I had heard about the cache-manifest, it is new to html5, it basically cache files like js and css, but I'm not sure if it can also cache images.
try to check this link for more info http://www.w3.org/TR/html5/offline.html
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)