Stop images used in post from hotlinking

Stop images used in post from hotlinking

This happens to most of the blogs, who write tutorials where the other blogger shares your post on his blog by hotlinking your images. Going through this way, all the image shared in his blogs, takes your server bandwidth to load those images. The .htaccess hack used here will stop hotlinking of images and display a default image for hotlinked images. So create a new image with the name of stophotlink.jpg and upload it to your image folder.

RewriteEngine On

#Replace ?mysite.com/ with your blog url

RewriteCond %{HTTP_REFERER} !^http://(.+.)?yourblog.com/ [NC]

RewriteCond %{HTTP_REFERER} !^$

#Replace /images/nohotlink.jpg with your “don’t hotlink” image url

RewriteRule .*.(jpe?g gif bmp png)$ /images/stophotlink.jpg [L]