2
Caching CSS & JavaScript using Rewrite Rules in IIS6
Recently I’ve been working on improving the caching within the website at Huddle to improve performance for users. After reading around, I found the following rules to be valuable.
- Cache your CSS and JavaScript forever (set a long, long expiry)
- Handle updates by changing the URL of your CSS and JavaScript
When caching “forever” the main problem is if you release an update to “styles.css” the browser caches the URL of that file, but won’t pick up any future updates unless the user clears their browser cache (you don’t want to have to tell people to “Ctrl + F5″). By changing the URL of the file, the browser thinks it’s requesting a new file, and your updates get applied. But how do you go about doing this without it becoming a pain to manage?