假设我有Default Web Site
个文件夹。
粗略地说,树看起来像这样:
|- Server
|- Default Web Site
|- folder1
|- folder2
我想将用户重定向到我网站上的不同文件夹,具体取决于他们的IP掩码。
例如,如果用户的IP具有以下模式:
- 10.10.10.* IIS has to redirect to "folder1"
- 11.11.11.* IIS has to redirect to "folder2"
这可能吗?如果是这样,那怎么样?
答案 0 :(得分:2)
<rule name="RedirectBySourceIP1" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{REMOTE_ADDR}" pattern="10.10.10.(.*)" />
<add input="{URL}" pattern="folder1(.*)" negate="true" />
</conditions>
<action type="Redirect" url="/folder1" />
</rule>
<rule name="RedirectBySourceIP2" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{REMOTE_ADDR}" pattern="11.11.11.(.*)" />
<add input="{URL}" pattern="folder2(.*)" negate="true" />
</conditions>
<action type="Redirect" url="/folder2" />
</rule>