我试图在C#中编写以下url重写XMl,但我很难知道究竟是什么。这是现有的XML工作:
....and the div...
<div id="mi-debug"
onClick={this.onClick}
onMouseMove={this.onMove}
>
到目前为止,我在c#中尝试了什么:
<rewrite>
<rules>
<!-- BEGIN RULE TAG FOR HTTPS REDIRECT -->
<rule name="Force HTTPS and non-WWW only" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<add input="{HTTP_HOST}" pattern="^www\." ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://mycustomdomain.com/{R:1}" />
</rule>
<!-- END RULE TAG FOR HTTPS REDIRECT -->
</rules>
</rewrite>
我非常确定重定向到HTTPS工作正常,但我不确定重定向和非www的语法。
[UPDATE] 所以我尝试了上面的代码,但收到了:
var options = new RewriteOptions()
.AddRedirect("^(.*)$", "https://mycustomdomain.com/$1")
.AddRedirect(@"^www\.", "https://mycustomdomain.com/$1")
.AddRedirectToHttps(301);
app.UseRewriter(options);
什么?任何人?
谢谢!
答案 0 :(得分:0)
使用teleriks Fiddler检查并调查请求和响应