Let's look at how we can accomplish the same thing (and much better caching and site speed) using a simple RewriteRule.
So I have 2 files to demonstrate. /c/apache.css and /j/apache.js - now I have my htaccess setup so that .js and .css files are cached forever, so what do I do when I make an update to either of those files?
I create a RewriteRule in my .htaccess file so that /j/apache-001.js points to /j/apache.js, but the visitors browser only sees /j/apache-001.js, and when I update /j/apache.js, I only have to change the links in my XHTML to /j/apache-002.js and that forces the browser to use the updated file! As long as the HTML isn't being cached too aggressively, this system is great and I use it on all my clients sites.
The htaccess
CODE
RewriteEngine On
RewriteBase /
RewriteRule ^j/apache-([0-9]+).js$ /j/apache.js [L]
RewriteRule ^c/apache-([0-9]+).css$ /c/apache.css [L]
The XHTMLRewriteBase /
RewriteRule ^j/apache-([0-9]+).js$ /j/apache.js [L]
RewriteRule ^c/apache-([0-9]+).css$ /c/apache.css [L]
CODE
<link href="http://z.askapache.com/c/apache-004.css" rel="stylesheet" type="text/css" />
<script src="http://z.askapache.com/j/apache-004.js" type="text/javascript"></script>
<script src="http://z.askapache.com/j/apache-004.js" type="text/javascript"></script>
More robust/complex example
CODE
RewriteEngine On
RewriteBase /
RewriteRule ^([cij]+)(/?[a-z]*)/([a-z]+)-([0-9]+)\.([a-z]+)$ /$1$2/$3.$5 [L]
The XHTMLRewriteBase /
RewriteRule ^([cij]+)(/?[a-z]*)/([a-z]+)-([0-9]+)\.([a-z]+)$ /$1$2/$3.$5 [L]
CODE
<link href="http://z.askapache.com/c/anything-007.css" rel="stylesheet" type="text/css" />
<script src="http://z.askapache.com/j/anything-007.js" type="text/javascript"></script>
<script src="http://z.askapache.com/j/anything-007.js" type="text/javascript"></script>
Read the Original Article to learn more and combine this method with htaccess caching
