Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a series of sites that consists of a (1) public site, (2) administrative CMS and (3) image repository.

This question is specific to the image repository.

I want to access any images from any subdomain within a specific domain, but no more.

For example, if the domains for the above sites are:

  1. www.foo.com
  2. cms.foo.com
  3. images.foo.com

I would want to access the images from any domain and subdomain under foo.com,but I want linking from any other domain to fail.

As an additional issue, I would also like to add secondary domains that are allowed to link under the same rules (e.g. acmecorp.com would also be allowed to link).

P.S. In images.foo.com there are only JPG files. There are no PHP pages, so I would need to do this at the IIS7/web.config level.

Thank you.

share|improve this question

migrated from stackoverflow.com Feb 27 '12 at 17:42

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Sounds like you are looking for "URL Rewrite" whereby you can write custom rules to apply before the request hits your files. In your case, you'd need to define a "URL Rewrite" rule using the "Request Blocking" inbound rules template. You'd enter the allowed allowed host headers that should be in the content headers. Everything else would be blocked. http://www.iis.net/download/URLRewrite -Chris

share|improve this answer
Hi, yes this is what I need, but I can not figure out how to write the rule. Any help would be appreciated. I read the link you provided. Thank you. –  HumanBacon Feb 28 '12 at 21:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.