title: .htaccess rule stacking and 404 redirect
body: <p>The user requests a PNG image, say: <code>http://server/myfolder/subfolder/1234.png</code>. If that <code>.png</code> doesn't exist, then I want to show instead a <code>.gif</code> in the same folder of the same name except for the <code>.gif</code> extension, which should exist.</p>
  
  <p>Another addition is that we recently changed the directory structure so the URL that I need to check may have changed. For example, the URL above should be able to be reached by requesting either directly as <code>http:// server/myfolder/subfolder/1234.png</code>or by <code>http://server/oldfolder/1234.png</code>. The change in the directory structure can be expressed as:</p>
  
  <pre><code>RewriteRule oldfolder/(.*) myfolder/subfolder/$1 [L,QSA]
  </code></pre>
  
  <p>In both directories, I need to check if the file exists, and use a different image instead if necessary. Any help would be greatly appreciated.</p>