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.
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.
I’ve seen the query string idea, but the article linked explain why it is not a good idea to do so. Scroll to the bottom and read the end of the article.
BTW, cool blog you have. I hope you continue to write more articles!
Servers *should* (and almost always *do*, in my experience) take a query string into consideration when deciding whether to use cached pages.
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?
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 `?< ?php echo time(); ?>`. 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.
You must be logged in to reply to this topic.