How to stop image hotlinking

rpm

Admin
Staff member
Joined
Jul 22, 2003
Messages
66,805
Reaction score
5,057
Location
Johannesburg
If you want people to stop linking directly to images on your website to display on their website (hotlinking), put the following code in your htaccess file:

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://yoursite.com.*$     [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yoursite.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(gif|jpg|png|jpe?g|JPG|GIF|PNG)$ - [F]

Here is a nice place to test for hotlinking: http://altlab.com/hotlinkchecker.php
 
Top
Sign up to the MyBroadband newsletter
X