Jump to content
xisto Community
Sign in to follow this  
nirvaman

Avoid Hot-linking How to avoid hot-linking

Recommended Posts

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

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 accessRewriteCond% (HTTP_REFERER)! ^ $# Licensed from my domain (mydomain)RewriteCond% (HTTP_REFERER)! ^ Http:// (www \.)?) (Mydomain \. Com / .* $ [NC]# Authorized translation from GoogleRewriteCond% (HTTP_REFERER)! Http://translate ^ \. Google \ ..* (www \.)?) (Mydomain \. Com .* $ [NC]# Permitted From the Google translationRewriteCond% (HTTP_REFERER)! Http://translate ^ \. Googleusercontent \ ..* (www \.)?) (Mydomain \. Com .* $ [NC]# Released for research images of GGRewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Gstatic.com \ ..*/.*$ [CN]# Licensed from Google cacheRewriteCond% (HTTP_REFERER)! Http://64 ^ \ .233 \. (167 | 183) \ .104 .* $ [NC]RewriteCond% (HTTP_REFERER)! Http://66 ^ \ .102 \ .9 \ .104 .* $ [NC]# Licensed from Google Image SearchRewriteCond% (HTTP_REFERER)! Http://images ^ \. Google \ ..*/.*$ [CN]# Licensed from Yahoo cacheRewriteCond% (HTTP_REFERER)! Http://72 ^ \ .30 \ .186 \ .56 .* $ [NC]RewriteCond% (HTTP_REFERER)! Http://216 ^ \ .109 \. (117 | 125) \. (130 | 135) .* $ [NC]# Licensed from the Yahoo searchRewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Search \. Yahoo \. Com / .* $ [NC]# Authorized translation from Yahoo and AltavistaRewriteCond% (HTTP_REFERER)! Http://babelfish ^ \. (Yahoo | altavista) \. Com / .* (www \.)?) (Mydomain \. Com .* $ [NC]# Licensed from MSN Image SearchRewriteCond% (HTTP_REFERER)! Http://search ^ \. Msn \ ..*/.*$ [CN]# Licensed from cache MSNRewriteCond% (HTTP_REFERER)! Http://cc ^ \. Msnscache \. Com / .* $ [NC]# Licensed from the Lycos searchRewriteCond% (HTTP_REFERER)! Http://vachercher ^ \. Lycos \. Com / .* $ [NC]# Released for Search AskRewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Ask \. Com / .* $ [NC]# Released for Search GigablastRewriteCond% (HTTP_REFERER)! ^ Http:// .* \. Beta \. Gigablast \. Com / .* $ [NC]# Released for Search PicsearchRewriteCond% (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 fileRewriteRule .* \. (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 !

Share this post


Link to post
Share on other sites

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. ;)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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. Xisto - Web Hosting offers this feature in cpanel. i don't know about other hosting companies that don't use cpanel...

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

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.

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites

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

I would tak a look at http://forums.xisto.com/no_longer_exists/

It is explained there.

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).


Share this post


Link to post
Share on other sites

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 accessRewriteCond% (HTTP_REFERER)! ^ $

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

RewriteEngine onRewriteCond %{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 ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.