Where your adventure begins
Showcase your website at Fusion GalleriesNetObjects Fusion 7 Websites Portal



OK your probably wondering what hot linking is.  Hot linking is theft of your images and your bandwidth. Someone who is hot linking has not only stole your images to place on there site, they have actually linked straight to them from there pages and are making your server serve them to there visitors.

So how do we prevent hot linking.  If your on a UNIX sever its pretty simple.  I've even created a demo for this tutorial. We will be using .htaccess again so if you've followed one of my previous tutorials using .htaccess its recommended you use that file again otherwise you'll lose what ever you did in that tutorial.

OK what we need.

  • A UNIX server that support mod_rewrite. If you don't have this Apache module then ask your hosting provider to install it.  This will not work with out it.
  • A text editor. Preferably one that can save in UNIX format.  One that I prefer TextPad. You can get a trial version here.
  • A third party ftp program that supports the Chmod command. One that I prefer is CuteFTP Pro from GlobalScape.  You can get a trial version here. If you really like it, consider purchasing it here.  If your a GF member a 10-15% discount does apply if purchased through us.

Notice: If you publish using Flat structure this will not work. Also if you use a NT server or Zend server this will not work either.

Step 1
Open TextPad and start a new document if it didn't for you.  Then go to file chose "Save As", then "All Files" and "UNIX". Name it .htaccess If you have previously made a .htaccess file with one of my previous tutorials, please open that file now.

Step 2
Decide if your just going to block the request or if your feeling nasty and would like to server a different image that reflects your feelings about what the person(s) is doing.

Step 3
For those that are just going to block the request copy this code and change to match your domain name, place this .htaccess in your document root, and your done.

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

For those that are wanting a little revenge use the following code and change the domain name, image name and path to match. In order for this option to work you need to have the .htaccess file and replacement image in your document root. If you have any images in your root directory and someone links to them it will cause an infinite loop. So if you can help it do not place images that are likely to be linked to in your root directory.

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

Step 4
Uploading your files.

Open your ftp client, connect to the server, and navigate to the document root. Then find your .htaccess file on your local hard drive, and upload it to your document root. Make sure to upload in ASCII and not BINARY. Finally, Chmod it to 644 or RW-R--R--.

Now if you decided to replace the hot linked image with another, find your local copy of the image and upload to the path you specified in the .htaccess file. (Should be the same place as your .htaccess file.)

Congratulations!!  You just stopped some thief from stealing your images and your costly bandwidth, unless you decided to server them another image.

As I promised at the beginning of this tutorial I have a demo of this. Click here to see the demo.


View the PREVIOUS page in this tutorial

Return to the TOP of this page

View the NEXT page in this tutorial


|  Fusion  |  Web Design  |  Hosting  |  Resources  |  gotFusion Store  | 

Problems with this page?  

All content copyright © 2002 gotFusion LLC.  The name gotFusion and the gotFusion ® logo are registered trademarks of gotFusion LLC
Copyright, legal notice & privacy statement