title: JavaScript doesn't parse when mod-rewrited through a PHP file?
body: <p>If I do the following (this is the actual/direct path to the JavaScript file):</p>
  
  <pre><code>&lt;script href="http://localhost/tpl/blue/js/functions.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>It works fine, and the JavaScript parses - as its meant too.</p>
  
  <p>However I'm wanting to shorten the path to the JavaScript file (aswell as do some caching) which is why I'm rewriting all JavaScript files via .htaccess to cache.php (which handles the caching).</p>
  
  <p><strong>The .htaccess contains the following:</strong></p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt; 
  RewriteEngine On
  
  RewriteBase /
  
  RewriteRule ^js/(.+?\.js)$ cache.php?file=$1 [NC] 
  &lt;/IfModule&gt;
  </code></pre>
  
  <p><strong>cache.php contains the following PHP code:</strong></p>
  
  <pre><code>&lt;?php
  
  if (extension_loaded('zlib')) {
      ob_start('ob_gzhandler');
  }
  
  $file = basename($_GET['file']);
  
  if (file_exists("tpl/blue/js/".$file)) {
  header("Content-Type: application/javascript");
  header('Cache-Control: must-revalidate');
  header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
  
  echo file_get_contents("tpl/blue/js/".$file);
  
  }
  
  ?&gt;
  </code></pre>
  
  <p><strong>and I'm calling the JavaScript file like so:</strong></p>
  
  <pre><code>&lt;script href="http://localhost/js/functions.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>But doing that the JavaScript doesn't parse? (if I call the functions which are within functions.js later on in the page they don't work) - so theirs a problem either with cache.php or the rewrite rule? (because the file by itself works fine).</p>
  
  <p>If I access the rewrited file-> <a href="http://localhost/js/functions.js" rel="nofollow">http://localhost/js/functions.js</a> directly it prints the JavaScript code, as any JavaScript file would - so I'm confused as to what I'm doing wrong...</p>
  
  <p>PS: <em>I've tried changing the mime/content-type to text/javascript, aswell as clearing the browser cache - but no luck.</em></p>
  
  <p>All help is appreciated! :)</p>