Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Avoid Hot-linking


9 replies to this topic

#1 nirvaman

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 210 posts
  • Gender:Male
  • Location:Localhost
  • myCENT:12.94

Posted 27 March 2010 - 01:12 PM

Hi to all
Me :what's Hotlinking?
Wikepedia :

Quote

Inline linking (also known as hotlinking, leeching, piggy-backing, direct linking, offsite image grabs) is the use of a linked object, often an image, from one site into a webpage belonging to a second site. The second site is said to have an inline link to the site where the object is located.

So when you store an image on your server/webhosting account , and link to it on your webpage , and another *webmaster* come and link to your image from his webpage , without your permission , we say that he is hotlinking your images , and consumming your bandwidth *stealing it !* , but this will not be a problem , when the site who linked your images has not a good traffic , since it don't cost you more then few Mo 's , but the real peoblem is when a website with a huge traffic is linking your images and stealing your bandwidth !!
So , what to do , and how to prevent it from happening?
Here's the idea:
You have to put this code , in your .htaccess file to avoid this kind of practice :
# Disallow hotlinks
# Licensed from direct access
RewriteCond% (HTTP_REFERER)! ^ $
# Licensed from my domain (mydomain)
RewriteCond% (HTTP_REFERER)! ^ Http:// (www \.)?) (Mydomain \. Com / .* $ [NC]
# Authorized translation from Google
RewriteCond% (HTTP_REFERER)! Http://translate ^ \. Google \ ..* (www \.)?) (Mydomain \. Com .* $ [NC]
# Permitted From the Google translation
RewriteCond% (HTTP_REFERER)! Http://translate ^ \. Googleusercontent \ ..* (www \.)?) (Mydomain \. Com .* $ [NC]
# Released for research images of GG
RewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Gstatic.com \ ..*/.*$ [CN]
# Licensed from Google cache
RewriteCond% (HTTP_REFERER)! Http://64 ^ \ .233 \. (167 | 183) \ .104 .* $ [NC]
RewriteCond% (HTTP_REFERER)! Http://66 ^ \ .102 \ .9 \ .104 .* $ [NC]
# Licensed from Google Image Search
RewriteCond% (HTTP_REFERER)! Http://images ^ \. Google \ ..*/.*$ [CN]
# Licensed from Yahoo cache
RewriteCond% (HTTP_REFERER)! Http://72 ^ \ .30 \ .186 \ .56 .* $ [NC]
RewriteCond% (HTTP_REFERER)! Http://216 ^ \ .109 \. (117 | 125) \. (130 | 135) .* $ [NC]
# Licensed from the Yahoo search
RewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Search \. Yahoo \. Com / .* $ [NC]
# Authorized translation from Yahoo and Altavista
RewriteCond% (HTTP_REFERER)! Http://babelfish ^ \. (Yahoo | altavista) \. Com / .* (www \.)?) (Mydomain \. Com .* $ [NC]
# Licensed from MSN Image Search
RewriteCond% (HTTP_REFERER)! Http://search ^ \. Msn \ ..*/.*$ [CN]
# Licensed from cache MSN
RewriteCond% (HTTP_REFERER)! Http://cc ^ \. Msnscache \. Com / .* $ [NC]
# Licensed from the Lycos search
RewriteCond% (HTTP_REFERER)! Http://vachercher ^ \. Lycos \. Com / .* $ [NC]
# Released for Search Ask
RewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Ask \. Com / .* $ [NC]
# Released for Search Gigablast
RewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Beta \. Gigablast \. Com / .* $ [NC]
# Released for Search Picsearch
RewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Picsearch \ ..*/.*$ [CN]

RewriteCond% (HTTP_USER_AGENT) "^ Googlebot [CN]
RewriteCond% (HTTP_USER_AGENT) "^ Googlebot-Image [CN]
RewriteCond% (HTTP_USER_AGENT) "^ Googlebot-Mobile [CN]
RewriteCond% (HTTP_USER_AGENT)! MSNBot ^ [CN]
RewriteCond% (HTTP_USER_AGENT)! ^ Slurp [NC]
RewriteCond% (HTTP_USER_AGENT)! ^ Mediapartners-Google [CN]

# Redirect to file nohotlink depending on the type of file
RewriteRule .* \. (Jpe? G | gif | bmp | png) $ http:// (destination-website) / hotlink. $ 1 [NC, R, L]

Replace mydomain () with your domain extension and (destination-website) to a Free web space, rapidshare for example, or others it's your choice !

#2 deadmad7

    Privileged Member

  • KS GFX Crew
  • PipPipPipPipPipPipPipPipPip
  • 869 posts
  • Gender:Male
  • Location:Standin' right behind you...
  • Interests:Ultra Pwning...
  • myCENT:66.04

Posted 27 March 2010 - 04:27 PM

Thanks. Nice tutorial you have there, could help a ton of people. Alternatively, if you are using Mambo, Joomla or Wordpress, you can find the plugins that does this automatically. One draw back though, avoiding hotlinking reduces the amount of brandwith used but reduces the site's popularity. ;)

#3 nirvaman

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 210 posts
  • Gender:Male
  • Location:Localhost
  • myCENT:12.94

Posted 27 March 2010 - 05:19 PM

That's the price you are going to pay to save your bandwidth !
And by the way , how can your images increase your popularity ? i knwo images with good keyword can increase your traffic when people are searching for that keyword on image search engine ....more details please

#4 anwiii

    I wont bite...unless you WANT me too

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2,704 posts
  • Gender:Male
  • Location:Chilhowee, MO
  • Interests:watching grass grow....
  • myCENT:62.06
  • Spam Patrol

Posted 27 March 2010 - 06:30 PM

that's usefull, but i think an easier way for users who have it, is just to use hot link protection directly through their cpanel and set it up that way. computinghost offers this feature in cpanel. i don't know about other hosting companies that don't use cpanel...

#5 nirvaman

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 210 posts
  • Gender:Male
  • Location:Localhost
  • myCENT:12.94

Posted 28 March 2010 - 08:52 AM

That's true anwii , we have this option enabled on computinghost , but people who stuck with other mediocre hosting providers , will need this to prevent hotlinking from happening .
Computinghost are the best , hope they will continu doing the good job ;)

#6 Бојан

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 106 posts
  • Gender:Male
  • Location:Macedonia
  • myCENT:78.56

Posted 28 March 2010 - 11:55 AM

Finally some useful tutorials that i need for my website. Thank's mate. ;)

#7 T X

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 56 posts
  • Gender:Male
  • Location:Rochester, NY
  • myCENT:1.63

Posted 30 March 2010 - 12:13 AM

Thanks for this. I'll be sure to bear this in mind when I'm starting up my site.

One concern though is what if you want to allow hotlinking to certain images or such?

Quote

Bandwidth theft or "hotlinking" is direct linking to a web site's files (images, video, etc.). An example would be using an <img> tag to display a JPEG image you found on someone else's web page so it will appear on your own site, eBay auction listing, weblog, forum message post, etc.

Bandwidth refers to the amount of data transferred from a web site to a user's computer. When you view a web page, you are using that site's bandwidth to display the files. Since web hosts charge based on the amount of data transferred, bandwidth is an issue. If a site is over its monthly bandwidth, it's billed for the extra data or taken offline.

A simple analogy for bandwidth theft: Imagine a random stranger plugging into your electrical outlets, using your electricity without your consent, and you paying for it.
So in other words, how would I go about keeping everything off-limits with hotlinking and then making certain files able to be hotlinked.

#8 dasmeaty

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 33 posts
  • Gender:Male
  • Location:England
  • myCENT:41.30

Posted 30 March 2010 - 05:05 PM

The problem I often see from this is that it allows google to cache the image for its image search but often after entering through the google frame and clicking view full size image the anti hotlink sign appears.

Do they use a different method or is this method likely to cause this? As I want to prevent people from uploading my image to their site, but I also want them to be able to view the full size image from google if they so wish (I don't want to make the experience of any of my visitors harder than it needs to be).

#9 T X

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 56 posts
  • Gender:Male
  • Location:Rochester, NY
  • myCENT:1.63

Posted 30 March 2010 - 07:08 PM

You should be able to allow certain sites to hotlink, however I wouldn't know how.

I would tak a look at http://www.blogtechnika.com/how-to-allow-s...ing-by-htaccess

It is explained there.

View Postdasmeaty, on Mar 30 2010, 01:05 PM, said:

The problem I often see from this is that it allows google to cache the image for its image search but often after entering through the google frame and clicking view full size image the anti hotlink sign appears.

Do they use a different method or is this method likely to cause this? As I want to prevent people from uploading my image to their site, but I also want them to be able to view the full size image from google if they so wish (I don't want to make the experience of any of my visitors harder than it needs to be).


#10 FouGilang

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 381 posts
  • Gender:Male
  • Location:Majenang, Indonesia
  • Interests:woman, duh
  • myCENT:24.68

Posted 01 April 2010 - 04:44 AM

Quote

As I want to prevent people from uploading my image to their site, but I also want them to be able to view the full size image from google if they so wish

well
the 3 first htaccess code above should do what you wanted, i mean this section of code
# Licensed from direct access
RewriteCond% (HTTP_REFERER)! ^ $

anyway, this is how my htaccess looks like at the moment

Quote

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?blablabla.net(/)?.*$ [NC]
RewriteRule .*\.(mp3)$ http://blablabla.net/no-hot-link.html [R,NC]
basically it just make that my mp3 openable via direct link from my site or by writing the full address to the browser or downloader address bar, while the other site must take their time to open the no-hot-linking.html ;)




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users