I'm using the PHP script for JSMin to remove comments and whitespace from my javascript and css files before serving. If I set
<script src="jsmin.php?file=myfile.js">
the file is not ever cached, since the Last-Modified HTTP header is never checked for a script. So in order to run the files through JSMin and (hopefully) enable caching, I'm using .htaccess with the following settings:
RewriteEngine on
RewriteRule ^.*$ jsmin.php?file=%{REQUEST_FILENAME} [NC,L]
I can then use:
<script src="myfile.js">
and get the effects of JSMin.
Apache still doesn't serve the file with the Last-Modified header, so it is still not cached by the browser. Is there a way I can look at the If-Modified-Since header in Apache and only serve the JSMin script if the file in question has been modified since the appropriate time? Otherwise, I'd like the browser to use a cached version.