Thursday, June 27, 2013

How to protect your bandwidth from hotlinking images

To protect your images from being accessed on other websites and consuming your bandwidth, you can put the following code in the .htaccess file under your public_html folder :
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?*$ [NC]
RewriteRule \.(gif|jpg|js|css)$ - [F]
Please make sure that you replace ‘’ with your own domain name, the hotlinked image will be broken if its not loaded at your website.

No comments:

Post a Comment