nix, shell, perl, php, mysql and mac os x tips and tricks

Thursday, October 25, 2012

Use mod_rewrite RewriteCond to do something when a requested file (like an image) does not exist

RewriteCond %{REQUEST_URI} ^/images/sa/regular/(.*)\.JPG$ [NC]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^(.*) /tools/missing_image.jsp\?image=%1 [L]