title: Apply htaccess rewrite-rule on rewritten URL
body: <p>Is it possible to apply a .htaccess rewrite-rule on an already rewritten URL?</p>
  
  <p>Example:
  I want to resize my pictures with <code>timthumb.php</code> (most recent version, so there should be no security flaw any more). But the URL should look fine, therefore I created this rewrite-rule:</p>
  
  <pre><code>RewriteRule ^rz/(.*)x(.*)/r/(.*) /themes/Nerdtalk/timthumb.php?src=$3&amp;h=$2&amp;w=$1&amp;q=80
  </code></pre>
  
  <p>This rule is working fine, but before starting timthumb.php which may re-direct to a cached file, I want Apache to check, if the file exists and let Apache redirect to the cached file, so timthumb.php won't be started.
  Therefore I created this ruleset:</p>
  
  <pre><code>RewriteCond %{SCRIPT_FILENAME} timthumb.php
  RewriteCond %{QUERY_STRING} src=(.*)\.(png|jpe?g)&amp;h=([0-9]+)&amp;w=([0-9]+)&amp;q=([0-9]+)
  RewriteCond %{DOCUMENT_ROOT}/cache/%1-%4-%3-1-%5.%2 -f
  RewriteRule ^.* /cache/%1-%4-%3-1-%5.%2 [L]
  </code></pre>
  
  <ol>
  <li><p>Can an already rewritten URL be rewritten a second time?</p></li>
  <li><p>Is the second part correct? </p></li>
  <li><p>If there is a possibility to merge these two rulesets, can you please tell me how?</p></li>
  </ol>