< -- BuySellAds Ad Code ALLEN -->

Stop People Hot Linking To Images

IT Problem

I had / have an issue where I was finding alot of 404 errors in webmaster tools saying that google could not find a certain image etc. This was down to some other website using my images on their web pages. this is quite a big problem on the internet. One they are your images you have created and spent time on and two it steals your expensive bandwidth.

The term is called “hot linking” or “in line linking”, where basically rather than using their own images they enter the url to your images and it shows your images.Not nice. we can block this with a few lines of code luckily in your .HTaccess file. OK before we go any further if you do not know how to edit your .htaccess file in cpanel read an the earlier article here.Then continue. Here is a wikipedia article on hot linking http://en.wikipedia.org/wiki/Inline_linking

Remember always take a backup of this file before any modification.

IT Solution


Now that you how to edit your .htaccess file we are going to enter the code below at the bottom of it to stop people hot linking  / stealing your images of your website. Ok once you in your htaccess file copy the the code below to the bottom of your file. replace yourwebsite.com with your domain name.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^yourwebsite.com [nc]
RewriteRule ^(.*)$ http://www.yourwebsite.com/$1 [r=301,nc]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourwebsite.com/.*$ [NC]
RewriteRule \.(gif|jpg|js|css|bmp|png)$ – [F]

<Files .htaccess>
order allow,deny
deny from all

You will see the line RewriteRule \.(gif|jpg|js|css|bmp|png)$ – [F], enter whatever type of files name you would like to stop users stealing, so if its windows media files then enter wmv etc.IF your a vindictive person you could even put picture inplace of the ones they are linking to add this line, changing the image ( seethisimaginstead.jpg )to one of your choice.


RewriteRule \.(gif|jpg|js|css|bmp|png)$ /image/seethisimaginstead.jpg

Once your happy with the files you want to stop being linked to save the file and your done.

Tags: stop hot linking

Allen White

Allen is an IT Consultant and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5, 6 and HP ASE, AIS - Network Infrastructure.

Comments (1)

  • Avatar



    Hi Allen!

    Nice! But how can I redirect the visits to post/page related to an image.jpg?



Leave a comment



What Web Browser Do You Use?

View Results

Loading ... Loading ...


What do you prefer..VMware or Hyper-V?

View Results

Loading ... Loading ...