You are currently browsing the page Anti Direct Linking in the Miscellaneous category.

Anti Direct Linking

Bandwidth, direct linking, hot linking, etc. When you direct link or hot link, it's when you insert an image hosted somewhere different from your server. If you do this, you steal bandwidth! The domain owner has a bandwidth limit and he/she paid for it. For exemple, you want to put an image and you write this in your code:

<img src="http://anotherdomain.com/image.gif" alt="" />

This = bad bad bad! Well, anyway, if you're a "victim" you can try this useful little code... It deals with htaccess so take care! (source of the code) In your htaccess file, paste this:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?DOMAIN.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://URL.COM/DIE.GIF [R,L]

Well, you just have to replace domain.com by your domain name... Then, I recommend you to host a little image somewhere on a free server, it will be shown when someone direct link your pic... Replace url.com/die.gif by the picture's url. You shouldn't host it on your server because it will take your bandwidth as well.

Print This Post Print This Post



Sponsors


Leave a Comment

Works? Doesn't work? Other tips? Please leave a comment! :)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

To post codes, please go to SimpleCode and transform your codes first, so that it will displayed properly. Indeed, < and > need to be converted to &lt; and &gt; :)


Close
E-mail It