blocking hotlinking, apache mod_rewrite?

A certain site hotlinked a ton of images from one of my sites. I do allow "friendly" sites to hotlink certain images with permission.

How can I block this certain site that is hotlinking my images?

So say I want to block three sites from hotlinking my images, I would do,

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?website.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?website1.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://www.mywebsite.com/nohotlink.jpg [R,NC]

How do I get that so it blocks only hotlinked images on website.com & website1.com and redirects too nohotlink.jpg? It isn't working....

 

 

 

 

Top