Stop image hotlinking using an htaccess file

Other websites linking to images on your website can cause a considerable increase of your bandwidth usage especially if that website has tons of visitors. The below script stops images from your website showing on other websites. Thus if someone is linking directly to an image on your website it will not show on there website.


RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+.)?websitename.co.za/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*.(jpe?g|gif|bmp|png)$ - [F]</code>

Copy the above and paste it into your .htacess file, update the website name and upload it. This should stop other websites from hotlinking to your images.

Hope it helps. Nathaniel

Other Posts

%d bloggers like this: