[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

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,
2 Solutions
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 (http://www.isapirewrite.com/).

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.

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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now