Avoiding Hot Linking to Images

2006 Sep 7

Bandwidth is precious, and seeing a bandwidth limit exceeded on your website is just so frustrating. Blocking unwanted referrers from your site may be your best option. If you are using apache as your webserver then you can take advantage of its mod_rewrite module to block unwanted referrers.

You need to modify your .htaccess file to block access to large files such as, images, mpeg, avi, etc. :


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?domain\.com [NC]
RewriteRule .*\.(jpg|gif|avi|wmv|mpg|mpeg)$ http://www.domain.com/nohotlink.jpg [R,NC,L]

Tweet this post

Leave a comment


About Me


Alfredo Sanchez is an internet professional focusing on the study search engines behavior in particular. Supports Free Open Source Software and currently develops applications with it using XAMPP.

Recent Entries

Close