使用以下规则,我可以成功重写 url 以重定向到 app/index.cshtml。不应重定向图像、css 和 javascripts 等 Som 资源,因此我使用了条件:
<rule name="AngularJS">
<match url="(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{URL}" negate="true" pattern="\.png$" />
<add input="{URL}" negate="true" pattern="\.css$" />>
<add input="{URL}" negate="true" pattern="\.js$" />
</conditions>
<action type="Rewrite" url="app/index.cshtml" />
</rule>
但是一旦我开始使用缩小的内容,请求的 URL 就会类似于:
/myapp/bundles/utilities?v=EH9YuZDBt_fj7iqRP2QA8lCkJ59wjV6woELIwvR7irk1
如何防止这种类型的 url 被重定向?