Clan Adverts

Block images from being linked by other sites

Description: This is a short tutorial on how to block images from being hotlinked by other sites.
Version: 1.0
Added on: 18 January 2009
Author: Floppy
Difficulty Level: Very Easy
Views: 534
Rating: 10.0 (2 Votes)
Detailed Profile

This short tutorial will explain how to block images from being linked from other sites. It is a term better known as hotlinking.

To use this hack you must insure that apache rewrite engine is enabled. The best way to find that out is simply by trying.

You need to create a .htaccess file with the following code.

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?clan-themes.co.uk(/)?.*$     [NC]
RewriteRule .*.(gif|jpg|jpeg|bmp|png|jpeg)$ - [F,NC]


Now change the domain clan-themes.co.uk to your domain. Next, modify any image file types to the line below if you wish to block them also

Code:
RewriteRule .*.(gif|jpg|jpeg|bmp|png|jpeg)$ - [F,NC]


Now, upload your saved .htaccess file to the image directory and any thumbnail directories.

That is it!

Submitted by floppy