【发布时间】:2012-09-01 01:57:35
【问题描述】:
我遇到以下情况,网址重写规则相互冲突:
- 规则 1:我需要将我的域重定向到 https
- 规则 2:我需要重定向 www.mydomain.com --> https://mydomain.com
- 规则 3:我需要将 www.mydomain.com 和 mydomain.com 都重定向到 https://mydomain.com/myfolder,但如果我有 mydomain.com/mysecondfolder,则应该只重定向到 https://mydomain.com/mysecondfolder
除了将 www.mydomain.com 重定向到 https://mydomain.com 之外,我所能实现的就是一切(只是因为它与其他规则发生冲突,如果它单独工作的话)。
我的规则是:
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
<rule name="redirect to myfolder" enabled="true">
<match url="^$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="/myfolder" />
</rule>
【问题讨论】:
标签: iis iis-7 url-rewriting url-redirection