The browser can simply read the cache control header for the. htaccess file, and the cache header will require the browser to keep the picture or any other media for 2 weeks (or more) so that the browser can call the picture at any time until the picture expires. After two weeks, the browser again caches expired pictures. In the event that the browser cache is emptied, the browser reloads the picture or other media from the cache.
1, open the. htaccess file of the root directory where the Web site resides, if not, create a new one.
2, enter the following code
The code is as follows |
Copy Code |
# Image and Flash content Caching for one Month <filesmatch ". (flv|gif|jpg|jpeg|png|ico|swf) $ "> Header set Cache-control "max-age=2592000" </FilesMatch> |
Description: The above code, is the browser cache format flv,gif,jpg,jpeg,png,ico,swf format file one months. If you want to change the cache time, modify the Max-age value
3, if you need to cache other format files, please modify the format OK