Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to implmenet a scenerio where my website's images are stored in an Amazon S3 bucket. So far, i've setup the bucket and the CNAME record so that images are correctly served from S3 via the URI pattern: 'http://images/[image files]'

Now I want to convince IIS to rewrite incoming requests to point to S3. The site's images are currently stored as:

Working off several samples for IIS's URL Rewrite module, this is the rule that I'm thinking should work but obviously isn't. Since I'm testing this, I literally am working in the subdomain named testing. The above URL really _does resolve to my logo.jpg.

<rule name="Redirect Images" stopProcessing="true">
    <match url="*)" />
    <action type="Redirect" url="{R:0}" />

mny thx

share|improve this question
up vote 2 down vote accepted

The match url field is just the url part, so it needs to be "content/images/(.*)". That should cause your rule to work.

Make sure to update your HTML source whenever possible to use the path. Then the client-side redirect doesn't need to be performed and the URL Rewrite rule is just a backup for old leftover links.

You can also consider ARR as a reverse proxy so that there isn't a client-side redirect when an image is called.

share|improve this answer
Thankx! Following up on the HTML source angle... in the case of images that construct the site's layout - it's templates (as opposed to images of products, or content oriented), I've always used the 'site relative' method but that's what's made this process harder than it should. Perhaps I should just bite the bullet, re-code the links using a app property setting to spell out the URI. thouhts? and thanks! – justSteve Jun 13 '11 at 18:07
Re-coding the links is usually the best long term bet. Using an app property would be great, then you can easily switch it in the future. URL Rewrite outbound rules is another option (although the app property is probably better long term). The outbound rules can parse the page on the way out and update the path for you. The inbound rule that you started with would catch any left-over links that still made it through the other changes. – Scott Forsyth - MVP Jun 13 '11 at 20:50

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.