Rob Garrett - Blogs

Welcome to Rob Garrett - Blogs Sign in | Join | Help
in Search
Google

Software/Technology Discussion

Software and Technology Tid-bits

Disabled Hotlinking

I have disabled hotlinking of images on all of my web sites.

What is hotlinking?
A good explanation of hotlinking can be found here, essentially hotlinking involves remote web sites linking content directly from another web site via URL.  Hotlinking is typically practiced in the blog sphere when a blog owner links to an image hosted on another blog/web site.

What is wrong with hotlinking?
Hotlinking steals bandwidth from the server hosting the content. Hotlinking should be avoided by downloading the referenced content from the original host site and hosting the copy locally.

What can be done to prevent hotlinking?
When a web server receives a request for content; an HTTP referrer string, indicating the URL of the requesting page is packaged with the request. If referrer string indicates a remote web site, and the URL extension indicates content, the request can be blocked. Certain web servers can detect requests for content using an .htaccess file. Microsoft Internet Information Server (IIS) uses HTTP filters instead of .htaccess files.

Michael R. Brumm has developed LeechBlocker, an ISAPI filter to block hotlinking requests.

Michael was good enough to provide the source to his filter. I have made some code changes to detect nGallery photo requests, which uses the .aspx extension. I wanted to allow remote sites to reference my blog and nGallery pages (also .aspx) but not the photos directly, so I only block certain requests where the address matches nGallery's URL pattern. My changes can be downloaded here.

How can I tell if my web site is safe from hotlinking?
http://www.htmlbasix.com/disablehotlinking.shtml provides an .htaccess generator and checking tool for your web site.
Share this post: Email it! | bookmark it! | digg it! | reddit!
Published Saturday, March 26, 2005 3:05 PM by Rob Garrett

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit

Blurb


Head Shot
Rob Garrett is a British Expat living in Maryland USA. Rob is a trained software engineer and experienced in Windows .NET development.

Rob enjoys listening to Rock music, posting to blogs, driving in the country with the sunroof open, beer (not in conjunction with country driving) and spending time with his family.

This Blog

Syndication

Powered by Community Server, by Telligent Systems