and update the version number whenever you change things. This is a maintenance nightmare, though, because you’ll have multiple versions of the same file lingering around next to each other and all the beauty of version control (You do use it, right?) is lost.
What you can do instead, is adding a GET-parameter to the filename, like this
and update the version number whenever you change things. This is a different maintenance nightmare because you have to update all resources and keep track of the changes. This can be scripted, but for small project it sure is overkill.
For the latest small project I tried to find a good solution that I could set up and didn’t have to worry about. I looked into parsing out the SVN revision and attach it, but that’s not a fun thing to do. Besides, the actual version is not important here, just a different number for each version. Here’s what I do (using PHP, this can be easily done in any other scripting language)
You might also be interested in this:
(scroll down to "Mistakes abound")
We did something similar to this, but then it was pointed out that some browsers dont cache any object with a ? in the url, so this might not work out as well as thought.
We have since done it with a rewrite rule like suggested, which works much better. (still only one file, but it the url can change when the file does, but apache should handle the headers correctly) - seems to work well :)