Deep Linking 2


Are you an Idiot? That’s what the title of the post I found said over the image of Kata Dobo I scanned in from this months Maxim Magazine for my last post. At this point in time I’d have to answer that question positively. I’m an idiot, a huge uneducated idiot. It didn’t say that anywhere on my site mind you, but on another site, buried deep within the link farming network of the internet.

I was tempted to leave a link and point his site out, but with Google Rank and the fact it’s not a very “work safe” place, I’ll leave his anonymity intact. I was incredulous. The guy had gone to the trouble to deep link directly to the image of Kata Dobo on my server and on top of it, he used it to point to a completely different article, an “Idiot Test” of some sort. I wonder if that was intentional or just plain luck on his part.

What really rubs it in is the disclaimer at the top of his page:

“Everything on this page has been stolen from others, i’m giving YoU the best of the Internet. (reminder: Broadband only) If you feel the urge to message me, please fill in this form.”

He deep linked me and I got hit. Hit bad! Of a total new bandwidth of 2.40Gb because of the last post, 1.26Gb went out as .jpg at the time of this post. Those numbers are in complete disagreement and I should have recognized it earlier. But I didn’t.

So to help everyone out I want to teach you a simple trick using .htaccess files to protect your bandwidth. The funny thing is, I’ve used the trick on other pages I’ve written. I have no idea why I never implemented it on mine.

Now there are a couple of things that need to be in place before this trick will work for you. First you need to be running an Apache Web Server. There is no reason not to be. The good people over at Apache have even taken the time to write a Windows version. You see the reason you should be running it instead of IIS is that it is FREE. Now I understand that you maybe hosting your site on some free web server with a domain name like http://members.shaw.ca/jagesquire that came with your internet connection. It doesn’t matter as long as they are running Apache Web Server. Though I should put the plug in that it just costs a few dollars to register your own domain and few more for hosting (we do that here at TransparentSmoke by the way).

Second you need to make sure that support for your .htaccess file is turned on. It’s a pretty powerful file. So some servers don’t allow it. Though I have yet to figure out why. If it’s not, send your web host a message and ask for it to be.

Now place all you images and files in a single directory and add the file inside this rar to that folder.

You’ll need to edit the file for it to work. Right now it blocks people from stealing files from a mythical website, we need to make a change to protect your files.

#.htaccess block for deep linking

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://??.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.??.com/.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://??.com [R,L]

Everywhere it says ??, replace it with your domain name.

What’s going to happen is that anyone attempts to steal the image and your bandwidth, they will now just get a box with a little red X just like this one.

File Not Found

And if they happen to place a link to your image to open it in a new window, it will bounce them back to your main page.

Now when you place cool content on your server, like this image, you can be sure that no one else will steal your bandwidth to place the content on their page. Of course this whole discussion begs another article. Maybe part of the problem is we don’t own any of the images, so they all should be public, but I know I pay for the bandwidth, so lets start by protecting that. I mean the whole internet is based on file stealing; Google Cache, Temporary Internet Files directories, File Mirrors. But I’ll leave that till next time…

Quiz

Leave a comment

2 thoughts on “Deep Linking

  • stan

    that is a great tutorial, I don’t think I have ever seen a tutorial on .htaccess. Something you forgot to mention is that some hosting companies also allow their customers use their Control Panel to block “hot-linking”. It is much easier for someone with no coding experience go about doing this…

  • jericho

    Google for htaccess + mod rewrite and you will find a ton of tutorials. Instead of just killing off their request for the little red X, you can redirect them to the image of your choice. Making a little 4 or 5k image with your URL/site is fun. If the remote site abusing your bandwidth deserves more of a prank, link them to a wide variety of fun images that don’t match their content.