I don't use htaccess to prevent others from hot linking my images on my blog because I get a healthy amount of traffic from google images. Problem is I came across a few sites today that are hot linking directly to the images. How can I stop them?
Add this code in your htaccess file to prevent hotlinking of images when someone hotlinks theyll just see a red x instead of the image This is the best method,than working in your Cpanel Hotlink protection RewriteEngine On RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://yourwebsite.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://yourwebsite/.*$ [NC] RewriteRule .*\.(gif|GIF|jpg|JPG|jpeg|JPEG)$
Doesn't this block hot linking all together. If you did this, wouldn't you lose google image referral traffic...that's something I want to avoid.
Yes you're right, this will block all images from anywhere that's not your own site. Why not try this? RewriteEngine On RewriteCond %{HTTP_REFERER} ^http://badguywebsite.com/.*$ [NC] RewriteCond %{HTTP_REFERER} ^http://badguy2website.net/.*$ [NC] RewriteRule .*\.(gif|GIF|jpg|JPG|jpeg|JPEG)$ Edit and put as many RewriteCond %{HTTP_REFERER} ^http://badguywebsite.com/.*$ [NC] lines as you need.
Surely it's better to ban individual domain names. i'm pretty cool with hotlinking but occasionally sites really abuse it. I had three South Korean news websites all link to a story at once, they didn't host the pictures themselves but rather took our text, published it verbatim on their website and then furnished the article with our pictures hotlinked from our server. I banned each one individually on noticing 120,000 uniques had hit those files. Remember, lots of forums that hotlink your images will send you lots of traffic too... be discriminating.