如何解决Web.config重写规则有时不起作用
我已经从Angular js应用中删除了#。为此,我启用了HTML5Mode,添加了Base标记。我在Web.config中添加了重写规则。一切正常。我在主URL的子文件夹中有另一个门户。例如 demo.domain.co 和 demo.domain.co/v1 。当我尝试重新加载 demo.domain.co/v1 或 demo.domain.co/v1/settings 时,它会重定向到主URL demo。 domain.co 。并非每次都在发生。它的。随机可复制。两个门户网站的基本标记如下
<base href="/">
<base href="/v1/">
<base href="/j/">
下面是我对Web.config的所有重写规则。
<rule name="AngularJS3" stopProcessing="true">
<match url="/j/" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/j/" />
</rule>
<rule name="AngularJS4" stopProcessing="true">
<match url="(.*recoverpassword*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/recoverpassword/" />
</rule>
<rule name="AngularJS1" stopProcessing="true">
<match url="(.*v1*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/v1/" />
</rule>
<rule name="AngularJS2" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。