Converting IIS7 URLRewrite Rules

I have successfully installed and appear to running the rewrite filter fine. However I am getting myself into a mess trying to convert some IIS7 rules. Below are the current IIS7 rules I have running;

<rules>

<rulename="Site5">

<matchurl=".*" />

<conditions>

<addinput="{HTTP_HOST}"pattern="^(www.)?192.168.1.24$" />

<addinput="{PATH_INFO}"pattern="^/Sites/5/"negate="true" />

</conditions>

<actiontype="Rewrite"url="\Sites\5\{R:0}" />

</rule>

<rulename="Site2">

<matchurl=".*" />

<conditions>

<addinput="{HTTP_HOST}"pattern="^(www.)?localhost$" />

<addinput="{PATH_INFO}"pattern="^/Sites/2/"negate="true" />

</conditions>

<actiontype="Rewrite"url="\Sites\2\{R:0}" />

</rule>

</rules>

The site I am constructing has multiple domains that run separate home pages for different customers but all run off the same code. Eventually domains will be redirected to e.g.;

Root\Sites\5\default.aspx

For now I am just using my internal and loopback IP addresses to test. The structure of my site is as follows;

Root\Iirf.ini

Root\Resources

Root\Functions

Root\Sites\5

Root\Sites\5\Resources

Root\Sites\5\Functions

Each of the “sites” (i.e. 5 or 2) folders has virtual directory links back to the folders further up the tree. This is needed so when the urlrewrite happens resources can still be found.
I have tried many different rules and at the moment am trying the following:

It looks to me like your slashes are going the wrong way. The target of the rewrite is a URL path. It is not a path in the IIS metabase. It is not a filesystem path. The slashes should lean this way / like in any URL.

The rule you have, redirects to the path. The condition you use deals with PATH_INFO. It compares PATH_INFO, to /Sites/5/ The ^ and $ refer to beginning-of-string and end-of-string respectively. Therefore any URL that is
not exactly /Sites/5/ will be rewritten. A url such as /Sites/5/X will be redirected. And it will be redirected endlessly.

You'll need to change your condition, or change your redirect rule, or a combination of those things.