- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’m a bit behind the ball on this. I have not used far-future Expires headers for cache control.
Main reason, I’m not sure on best-practices of doing this with the least amount of effort.
I’ve read [this article](http://derek.io/blog/2009/auto-versioning-javascript-and-css-files/ “this article”), but I’m not sure if this is the easiest way or the best way to do so.
Anyone have any insight to share?
Usually you’d just have one header file that you include on every page, so the easiest way I think would just be to add a query string every time you change the file. The browser will see it as a different file.
Servers *should* (and almost always *do*, in my experience) take a query string into consideration when deciding whether to use cached pages.
Sorry about that. Had a quick look at the article, saw it was doing all sorts of fancy server-side stuff, and didn’t scroll down all the way.
I would just change the query string manually. It’s unlikely that you would be liking up the same stylesheet/js file from lots of different files.
> So is this the way you guys are going about it? To append to the query string, are you utilizing a PHP function, or manually changing the query string value?
I usually append `?`. I’ll admit that’s lazy of me, but it works. A better approach is to set the appropriate headers.
If you’re only “basting the cache” once (e.g., you updated whatever, and you don’t plan on doing so again anytime soon) you might add the query string manually.