Recent posts


conversation


links

Stop Direct-Linking

Almost everyone has had this problem. Not only is someone stealing your graphics, but they’re using your webspace to host it, costing you money if you’ve got your own domain!

It’s really easy to stop, but you need your own domain or be hosted to do it. It’s even easier to stop if your domain control panel is CPanel. Just click on the Hot-Link Protection icon near the bottom of the page, specify what sites you want to protect (both domain and subdomain - http://www.yoursite.com and http://.yoursite.com) and click activate. If you want a replacement image to appear instead of just having a red ‘x’ appear, you’ll need to host it somewhere else, then copy the url into the box where it says ‘Url to Redirect to’. Press Activate and you’re all done!

The above method protects your whole site, but if you just want to protect a specific folder and be able to direct-link your own stuff from your site (e.g. forum avatars), or dont have CPanel, you’ll need to follow this more long-winded method.

First of all you need to create the folder online that you want to protect e.g image folder. If you want to protect an already existing folder, just go to the next step.

Open up Notepad and paste the following into it:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

If you want to replace the stolen image with a free advert for yourself, paste the following code instead

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

Change yourdomain.com to your domain URL and change http://www.yourdomain.com/picture.gif to the image url of that picture you want to show up instead

Save it as .htaccess (if it saves it as .htaccess.txt dont worry, just make sure you amend it once it’s uploaded.

Upload it to the folder that you want to protect

Dont forget to save your replacement image in your main folder or host it somewhere else, otherwise the direct-linkers will just get a red X, which is mightily boring ;)

That should be it! One thing to remember is that if you do have a replacement image, it’s still an image and will still be using bandwidth everytime someone views it. On the other hand, if you only have a red X appearing, the direct-linkers may think it’s just a temporary problem and may not remove it. A replacement image gets the point across and is also a free advert for you if you include a link in the picture text!



October 2008
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Other stuff