Block images

RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com$ [NC]
RewriteCond %{REQUEST_URI} !^media [NC]
RewriteRule \.(jpg|jpeg|gif|png)$ http://www.domain.com/stop.bmp [R,NC,L]

This is blocking all images in media folder to be shown from outside servers. I know HTTP_REFERER is not very powerful but enough for this work…

PROBLEM:

Can you please explain me the reason?

Regards,

thanks for ur reply.

cleaned all cache but not working.

You should convert that BMP into a web graphics format so that browsers other than Internet Exploder can display it and so that it doesn’t take thousands of times longer than necessary to download.

pedro,

While cacheing may be a (temporary) problem, my first reaction was that your {HTTP_REFERER} regex could be vastly improved. Give this a try:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\\.)?domain\\.com [NC]
RewriteCond %{REQUEST_URI} !^media [NC]
RewriteRule \\.(jpg|jpeg|gif|png)$ http://www.domain.com/stop.bmp [R=301,[COLOR="Magenta"]NC,[/COLOR]L]

I am NOT fond of your use of NC but, if your {path/filename}.{image extension} mixes case of letters, then leave it alone.

Note that you’ve permitted images from other than the media directory to be served.

Regards,

DK

Sounds to me like a caching problem in IE, since IE has no influence over what the webserver does or doesn’t allow. Have you tried clearing your cache?