redirecting hotlinked image in IIS and Cold Fusion

We have a small number of jpg files that are being hotlinked massively and resulting in a ton of traffic stealing.  Instead of blocking the traffic from these hotlinkers, we want to redirect the users requesting the jpg to an htm page.  Basically we want to let them see the picture but throw some content around it.  SO ... we want to achieve two items ...
1) We want other websites that have an img from our site embedded in their code, that the image will now have different information around it, instead of just a picture it will show some content as well as the picture.
2) If the other website (that is hotlinking) has a clickable link to one of our jpegs, we want it to automatically redirect to a real webpage instead of just displaying the jpg in a blank white page.

if someone has hotlinked the following picture:

we want it to redirect to some 'real' webpage like:

I figure there have got to be some software to get this working OR some custom code / dlls, isapi filter that help this process.

We are using a dedicated server (windows 2003) running IIS 6.0 and ColdFusion MX 7.

Thank you in advance,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

b0lsc0ttIT ManagerCommented:

The only way to do this is with a server "rewrite."  To the best of my knowledge IIS does not have a way to do this natively.  However there are some things you can install to add this ability.  One very popular one is ISAPI Rewrite (

Using it is not my expertise.  I am going to change the Web Language/Standards zone to the Windows 2003 zone so experts there can see this and help too.  Let me know if you want suggestions of other "programs" to use but ISAPI seems to be well documented and is very popular.

Let me know if you have any questions or need more information.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hotlinking is (amongst other implementations) just using a <img tag and point the src to a file on some elses webserver. Therefor adding a html is not an option. As for normal links from remote sites: you cannot actually add javascript to an image, so clientside scripting is not an option.

Depending on the server software you are using (apache / IIS / tomcat/ websphere / ... ) you can possibly do some redirecting based on HTTP_REFERER. A problem however is that not every one is having its HTTP_REFERER enabled. For the majority of the people you should be able to show another (smaller) image or an image with a hotlinking message.

Kind regards

while this isn't a redirect, you can secure your images easily using CF.

place your images in a non-web accessible folder

then use cfcontent

<cfcontent file="C:\someDirectory\MyImage.jpg" type="image/jpeg">

now the only way to load this file from the Web is to load the page with cfcontent. No more hotlinking

happymacandpcAuthor Commented:
Roonaan thanks for the information.  We are using IIS and the pages are ColdFusion.

Please confirm that i am understanding your post correctly ...
1) It sounds like for the actual  embedded images that are on the hotlinked website, there is no way to have an ad replace that picture UNLESS we literally replace the actual picture in our website's directory with a different pic that says something like "stop hotlinking my pic".   Because like you said, since they are using an img tag, there is no client side OR server side code we can write to have that image actually act as a clickable url.  Is that correct??
2) If on the hotlinked website, they have an actual clickable url to OURjpg, what you are saying is that there is a way to write some server side code that would redirect the jpg request to the url that we want.  Am I right here??
Forced accept.

EE Admin
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.