I am rewriting php generated thumbnails with igly urls into nice ones. instead of img.php?src=bla.jpg&w=200&h=100
the static filenames IMG-file_w200_h100.jpg
Because the rewrite is so complex and involves many variations, only urls starting with IMG- should be listening to the rewrite rule. The conditional first rule however doesnt seem to work: if i change it into IMF or something else, it still fires the rewrite rules! Any ideas as to why the conditional doesnt work?
# Rewrite imgcpu?src= thumbnail maker to nice static urls
RewriteCond %{REQUEST_URI} ^IMG.*$
RewriteRule ^IMG-(.+)_w(.+)_h(.+)_f(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3&f=$4 [L]
RewriteRule ^IMG-(.+)_w(.+)_q(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&q=$3 [L]
etc
Try:
The
RewriteCond
is actually processed after theRewriteRule
matches! Here's a diagram from the Apache docs: