问题描述
我已经从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 (将#修改为@)