我在azure应用程序服务的web.config中重写了一个URL,以将对“ www.example.com/ ”的所有请求重写到子文件夹“ ./test / ”。 / p>
<rule name="test" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="/test/{R:0}" appendQueryString="true" />
</rule>
不幸的是,在我的asp.net核心站点中,被调用的URL是www.example.com/test/some-resource
而不是www.example.com/some-resource
。这有一些负面影响。
有没有办法为我的 asp.net core 应用程序更改baseUrl?
答案 0 :(得分:0)
添加如下所示的条件,negate
为true可以确保它匹配除基本URL之外的所有内容。
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="www.example.com" negate="true" />
</conditions>
有关更多详细信息,您可以参考此article。