Is it possible to apply a .htaccess rewrite-rule on an already rewritten URL?
Example:
I want to resize my pictures with timthumb.php
(most recent version, so there should be no security flaw any more). But the URL should look fine, therefore I created this rewrite-rule:
RewriteRule ^rz/(.*)x(.*)/r/(.*) /themes/Nerdtalk/timthumb.php?src=$3&h=$2&w=$1&q=80
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:
RewriteCond %{SCRIPT_FILENAME} timthumb.php
RewriteCond %{QUERY_STRING} src=(.*)\.(png|jpe?g)&h=([0-9]+)&w=([0-9]+)&q=([0-9]+)
RewriteCond %{DOCUMENT_ROOT}/cache/%1-%4-%3-1-%5.%2 -f
RewriteRule ^.* /cache/%1-%4-%3-1-%5.%2 [L]
Can an already rewritten URL be rewritten a second time?
Is the second part correct?
If there is a possibility to merge these two rulesets, can you please tell me how?