We have here to web servers behind a router - one IIS and one Tomcat (on different machines / IP addresses). The domain is pointing to out external IP, which is forwarded to IIS (internal IP for example). I'm trying to do the following: when [www.]ourdomain.com is entered the default web site on IIS have to be loaded (this part is ok), but when test.ourdomain.com is entered I want to redirect this request to another web server ( for example). I created a site "test" on IIS and it is displayed when test.ourdomain.com is entered. Then I tried to redirect it with following rule: Requested URL matches the pattern: * (using wildcards) Condition: {HTTP_HOST} matches test.ourdomain.com Action type: Rewrite Rewrite URL:{R:0} but when I try to load test.ourdomain.com now I get IIS's error 404 page. Obviously I'm wrong :-) How can I do such a redirect?

1 Answer 1


A rewrite needs to be a relative path on disk, under the same website. That's what is causing the 404 error in your case.

A redirect will send a client-side redirect, but that won't work since is an internal IP that can't be accessed publicly.

What you need is ARR: http://www.iis.net/expand/ApplicationRequestRouting. It's a reverse proxy and will take the public request and forward it on to the internal server. This is the middle man between the client and the internal server. It leverages IIS and URL Rewrite so you're already much of the way there.

  • This helped me today - I thought you could rewrite to anything under the same domain (including different subdomains), but it wasn't working! Now am doing relative path, and dropping the subdomain component. Works great.
    – Matt
    May 17, 2010 at 22:21

You must log in to answer this question.