How To Prevent Hotlinking Inside Your Wordpress Blog

by Himanshu on December 3, 2009 · 21 comments

Hotlinking is a term used when an image from your site used in other site without changing its URL. The main disadvantage of hotlinking is your bandwidth used on another website. So ultimately it creates load on server.

To understand hotlinking you may assume any image with URL

http://www.blogtechnika.com/wp-content/uploads/2009/12/wordpressmonitor.jpg

Suppose any other user upload this picture and instead of hosting this image to his own site he link the image  to its original URL then whenever the image will open it use bandwidth of Blogtechnika instead of his site. So it will effect the speed of server. Sometimes it may effect the load time of your website.

Hotlinking thumb How To Prevent Hotlinking Inside Your Wordpress Blog

You can prevent hotlinking of your website by using .htaccess method. You can also check my previous article  on .htaccess method on How To Restrict Wordpress Admin Use By IP Address.For those who don’t know about .htaccess files please refer to my previous article.

1) Create a small image of any format, telling no hotlinking please.

nohotlink

2) Check the root folder of your blog. If there is any .htaccess file then open it on any text editor. Now copy and paste a code on  .htaccess file .

RewriteEngine On
#Replace ?mysite.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+.)?mysite.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your "don't hotlink" image url
RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]

Now load this file to the root folder of your blog. All done.

via Wprecepies

Subscribe to blogtechnika for more updates. Follow me on Twitter @techim.

Related posts:

  1. How To Allow Some Sites For Hotlinking Images(If You Prevent Hotlinking by .htaccess)
  2. How To Restrict Wordpress Admin Use By IP Address
  3. How to make a Favicon for blog and upload it into root directory
  4. How To Install Wordpress (Step By Step Guide of Wordpress Installation)
  5. How to configure Robots.txt and upload it to root directory for Wordpress blogs

5 Tweets

{ 1 trackback }

You are now listed on FAQPAL
December 4, 2009 at 3:40 pm

{ 20 comments… read them below or add one }

1 Shivaraj December 3, 2009 at 8:44 am

Ya hot linking will create unnecessary burden to server,it will defiantly restrict hot linking thanks for info.

Reply   More from author

2 MostlyBlog December 3, 2009 at 9:23 am

good post himanshu, i really don’t know much more about this but now i understand thanks for sharing
.-= MostlyBlog´s last blog ..Top 10 Newest Touchscreen Mobile Phones of 2009 =-.

Reply   More from author

3 Jaspal December 3, 2009 at 9:50 am

good ploy .. i have subscribed yr blog with google reader and you have full feeds in it .. but there is no images displayed in posts … so i feel if your google reader subscriber will have problems.

but hot-linking will reduce your server burden for sure
.-= Jaspal´s last blog ..100+ facebook apps for productivity and tools for achieving all your goals =-.

Reply   More from author

4 Pascal December 3, 2009 at 10:38 am

I am also not able to see images of Blogtechnika in Google reader.
.-= Pascal´s last blog ..Free Worpress.com to Self Hosted Wordpress.org Migration: =-.

Reply   More from author

5 Himanshu December 3, 2009 at 11:07 am

Thanks for notifying me, now the problem is solved. :)

Reply   More from author

6 Raju December 3, 2009 at 3:05 pm

would help everyone if you explain how you solved it!
.-= Raju´s last blog ..How to Embed Google Wave in Your Blog/Website? =-.

Reply   More from author

7 Himanshu December 3, 2009 at 4:02 pm
8 Himanshu December 3, 2009 at 10:54 am

Thanks for subscribe to Blogtechnika, and really thanks for notify me about the problem, Let me check and figure out the problem. Thanks once again. :)

Reply   More from author

9 Harsh Agrawal December 3, 2009 at 12:10 pm

Himanshu this method is correct but will not work in most of the cases as people have mentioned above. So try to make sure you add a parameter for feed readers and gmail….
.-= Harsh Agrawal´s last blog ..How Mobile Phone Turned into SmartPhone =-.

Reply   More from author

10 Pascal December 3, 2009 at 10:36 am

I have two blogs. Example A & B. If my blog A has some images. It has been hot linked by B. If i did what you said here in my A blog , then Images won’t appear in B? Isn’t it? Is there any way give relaxation to my own blogs from this restriction?
.-= Pascal´s last blog ..Free Worpress.com to Self Hosted Wordpress.org Migration: =-.

Reply   More from author

11 Ruchi December 3, 2009 at 11:50 am

Great work Himanshu, thanks for sharing. I was not aware about it .
.-= Ruchi´s last blog ..Site Performance Feature added in Google Webmasters Labs =-.

Reply   More from author

12 Rajesh Kanuri December 3, 2009 at 12:41 pm

I was not aware of this and what you said is really corret .. will update my htaccess right away.. Thankd for the share
.-= Rajesh Kanuri´s last blog ..WordPress 2.9 Beta 2 is Available: Download & Explore =-.

Reply   More from author

13 Gabe | freebloghelp.com December 4, 2009 at 2:20 am

Simple enough! Nice tip on how to prevent hotlinking!

I wish there is a way to punish violators. Oh, what fun…
.-= Gabe | freebloghelp.com´s last blog ..10 FREE killer WordPress themes in 2009 =-.

Reply   More from author

14 India 365 December 4, 2009 at 11:31 am

Informative stuff, I have never thought of this hotlinking concept. In fact I did use this type of hot linking when I was at blogspot, but now I’m using my own server though.
Any ways that’s for the awesome article. I was also cautioned by Gagan (beepthegeek) but didn’t understand what he said at that point of time, and now its clear to me.

Reply   More from author

15 sriganesh December 6, 2009 at 8:40 pm

i have hotlinked my site, but sometimes it will restrict others to use my images and in some case it wont, what to do. sometimes ppl can get the images, so iam always renameing the image link in particular period and its a burdern to me.
.-= sriganesh´s last blog ..60 Cute Mascot Characters =-.

Reply   More from author

Leave a Comment

Additional comments powered by BackType

Previous post:

Next post:

©2009 BlogTechnika | Sitemap