How To Stop Bandwidth Thefts By Disabling Hotlinking

When other sites scrape your content and direct link to your site images, this causes an increase of server load. When your articles are popular, this can add up greatly and slow your server down. The good news is stopping sites from hotlinking to your images is a fairly easy fix. All you need to do is paste the following code in your .htaccess file of your websites root directory:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC] 
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

Note that Google is in there to let it pull your images for image search use.

Leave a Reply

Your email address will not be published. Required fields are marked *