Rewrite_mod and missed files

How to replace missed files using mod_rewrite.

Here my mod_rewrite rule to check and replace missed image with NotAv.jpg icon.

#Start rewrite Engine
RewriteEngine on

#if /var/www/ “Requested file name” is not equal to (f)inded
RewriteCond /var/www%{REQUEST_FILENAME} !-f

#then rewrite all file in /public not finded with NotAv.jpg image
RewriteRule ^/public/.*$ /public/images/NotAv.jpg [PT]

#Log directives.
RewriteLog rewrite.log
RewriteLogLevel 1

Leave a Reply

Your email address will not be published. Required fields are marked *

Antispam Question * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.