Prevent Image Hotlinking

Hotlinking equals to bandwidth stealing, if some one post the images on your server on their site they not only putting the images without permission, but they also steal and consume your bandwidth.

If you use Apache as your web server, you can simply overcome this image hotlinking problem. Just put this code in your .htaccess file, if you don’t have one just create a file named .htaccess on the root directory of your site.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?*$ [NC]
RewriteRule \.(gif|jpg|js|css)$ - [F]

Replace the “” with your own domain name. With this code, evertime someone place your images on their site, they won’t see anything and the images won’t be loaded.

Leave a Reply