How to cache/refresh static resources

They're a couple of ways to cache static resources, e.g. css, javascript and images.  You can specify the default cache values in .htaccess file (as shown below in ".htaccess_original"). After some tweaking effort, I managed to integrate this feature into CodeIgniter. The main issue of this solution would be retrieving the last modified date of each file.

Server Side
Server & Client sides
If there're css or javascript files that you need to load dynamically, then you would need to use another approach. For CodeIgniter, I set a config item, called "code_revision" which store the latest version number of your source project. PHP and Javascript will be referring to this variable for consistency. References:

No comments:

Post a Comment