title: Caching problem using "AddHandler application/x-httpd-php"
body: <p>Using .htaccess, I'm setting PHP handler to all my .css and ,js in order to output user-agent based code:</p>
  
  <pre><code> AddHandler application/x-httpd-php .css .js
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>&lt;?PHP if ($CurrentBrowser == 'msie') { ?&gt;
  .bind('selectstart', function(event) { ... })
  &lt;?PHP } ?&gt;
  </code></pre>
  
  <p>So, in fact, my code files are dynamically created but can be considered static files. That's because, once they have been compiled for the first time, browsers can get them back from cache and reuse them until I change their content.
  That's why I'm using fingerprinting/versioning and long time expiration on them:</p>
  
  <pre><code>[INDEX.PHP]
  &lt;script type="application/javascript" src="&lt;?PHP echo GetVersionedFile('/script.js'); ?&gt;"&gt;&lt;/script&gt;
  &lt;script type="application/javascript" src="/script.1316108341.js"&gt;&lt;/script&gt;
  
  [.HTACCESS]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule "^(.+)\.(\d+)\.(css|js)$" $1.$3 [L]
  </code></pre>
  
  <p>The problem is that those files, even if I send them with a proper header, are never being cached by any browser (I never get a 304 code, always 200). This is a log of my server responses:</p>
  
  <pre><code>[CHROME]
  Request URL:http://127.0.0.1:8888/script.1316108341.js
  Request Method:GET
  Status Code:200 OK
  -----
  Cache-Control:max-age=31536000, public
  Connection:Keep-Alive
  Content-Encoding:gzip
  Content-Length:6150
  Content-Type:application/javascript
  Date:Thu, 15 Sep 2011 21:41:25 GMT
  Expires:Fri, 14 Sep 2012 21:41:25 GMT
  Keep-Alive:timeout=5, max=100
  Server:Apache/2.2.17 (Win32) PHP/5.3.6
  Vary:Accept-Encoding
  X-Powered-By:PHP/5.3.6
  
  [MOZILLA]
  Request URL:http://127.0.0.1:8888/script.1316108341.js
  Request Method:GET
  Status Code:200 OK
  -----
  Date Thu, 15 Sep 2011 21:43:26 GMT
  Server Apache/2.2.17 (Win32) PHP/5.3.6
  X-Powered-By PHP/5.3.6
  Content-Encoding gzip
  Vary Accept-Encoding
  Cache-Control max-age=31536000, public
  Expires Fri, 14 Sep 2012 21:43:26 GMT
  Content-Type application/javascript
  Content-Length 6335
  Keep-Alive timeout=5, max=100
  Connection Keep-Alive
  -----
  Last Modified Thu Sep 15 2011 23:43:26 GMT+0200 (= time i loaded the page) (???)
  Last Fetched Thu Sep 15 2011 23:43:26 GMT+0200 (= time i loaded the page) (???)
  Expires Fri Sep 14 2012 23:43:26 GMT+0200
  Data Size 6335
  Fetch Count 10
  Device disk
  </code></pre>
  
  <p>What could be the problem? How can I force caching on these files?
  Many, many thanks!</p>