These days I can see lots of newbie bloggers unknowingly copying my blogs posts along with Images hosted here. I don’t blame them because they are doing it unintentionally and unaware of the effect of it. Infact 3 years back, I also did something like this and I already talked about this on my previous post Confession of a blogger.![]()
Though the price if paid by the owner of original content in terms of post duplication or bandwidth. If you not using any webhost like dreamhost which allows unlimited bandwidth, you might end up paying lots of money, because your host bandwidth is leeched by someone else.
One of the simplest way to avoid hotlinking of images is by editing your .htaccess file.
I will suggest take a backup of your .htaccess file, before editing it.
Now add these lines of code into your .htaccess file. Do replace the domain name with your domain name, and link of the image which you want to show on the spammer page.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yourdomain.com [NC]
RewriteRule .(jpg|jpeg|png|gif|exe|zip)$ http://www.yourdomain.com/images/nohotlink.jpg [NC,R,L]
Though this is most effective way of stop hotlinking of images and save your precious bandwidth.
Also read : How to secure your wordpress plugin folder using .htaccess method
Related posts:
- Block Visitors From Specific IP Address Using .htaccess method
- How to Create .htaccess File For Wordpress blog
- How to avoid Spam comments on Wordpress using .htaccess method
- How to edit your wordpress .htaccess file
- How to access Website Stats in Dreamhost
- No self ping Wordpress plugin : Stop pinging your own Blog post
- How to secure your wordpress plugin folder listing
- How to redirect wordpress default RSS feeds to feedburner without any plugin





{ 5 comments… read them below or add one }
Thanks for the post Harsh. This surely helps a lot.
I have used this and i think it is right now there in my .htaccess. very good and easy trick.
BTW, i like the way you link your posts. Here you have linked dreamhost post.
Nihar™s last blog post..Download Kaspersky Anti Virus 2010 Beta 9.0.0.313 & Kaspersky Internet Security 2010 Beta
I’m sure web hosts such as Hostgator and Just Host, etc also have scripts that allow you to do the same straight from your cPanel.
Great blog by the way. I get your posts delivered to my email box each day and some of the stuff coming through is very informative. I have even followed some of the advice on some of my blogs. I really enjoy your Wordpress plug-in features.
Tony
Ya….. I was Using A Plugin Till I noticed … That the Images Didn’t show up in also FeedBurner or Gmail ….
Any way to set an exception for domains like gmail, facebook, zimbio, feedburner feed etc…
i have placed the code you said but its now working can u tell y or there need to be added something .