【发布时间】:2018-12-24 21:28:49
【问题描述】:
我遇到了 IIS 网址重写问题。在第一条规则之后一切似乎都很好,但是传递给第二条规则的 url 在架构上没有“h”。我有一个踪迹,进来的网址是:
产品/car.aspx
然后通过下面的第一条规则:
https://fo.bar.com/product/car.aspx
但是接下来的规则是在 url 中传递的:
ttps://fo.bar.com/product/car.aspx
对此有任何想法都会很棒。以下是我在 web.config 中的规则
<system.webServer>
<rewrite>
<clear />
<rule name="HTTP to HTTPS" stopProcessing="false">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_HOST}" matchType="Pattern" pattern="^localhost(:\d+)?$" negate="true" />
<add input="{HTTP_HOST}" matchType="Pattern" pattern="^127\.0\.0\.1(:\d+)?$" negate="true" />
</conditions>
<action type="Rewrite" url="https://{HTTP_HOST}/{R:1}" />
</rule>
<rule name="Remove incorrect first char from query string" enabled="false" stopProcessing="true">
<match url="(.*)"/>
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{QUERY_STRING}" pattern="^\&(.*)"/>
</conditions>
<action type="Rewrite" url="{R:0}?{C:1}" appendQueryString="false"/>
</rule>
..................
【问题讨论】:
标签: asp.net-mvc iis url-rewriting