C# 将配置从HTTP重写为HTTPS无效
在我的.Net MVC网站中,如何添加重写规则以将我的网站url从http重定向到url为“”的网站的https 此外,我的网站几乎没有像“”和“”这样的其他域。我想添加重定向规则,以便仅将“”url重定向到“” 我正在web.Config文件中尝试以下规则,但它不起作用C# 将配置从HTTP重写为HTTPS无效,c#,.net,url-rewriting,C#,.net,Url Rewriting,在我的.Net MVC网站中,如何添加重写规则以将我的网站url从http重定向到url为“”的网站的https 此外,我的网站几乎没有像“”和“”这样的其他域。我想添加重定向规则,以便仅将“”url重定向到“” 我正在web.Config文件中尝试以下规则,但它不起作用 <rule name="HTTPtoHTTPS" stopProcessing="true"> <match url="(.*)" ignoreCase="true" /> <co
<rule name="HTTPtoHTTPS" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTPS}" pattern="^www.myleague.com" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
redirectType="Permanent" />
</rule>
请告诉我这里缺少什么问题已通过以下配置修复。谢谢大家的回复
<rule name="HTTP/S to HTTPS Redirect" enabled="true" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.myleague.com$" ignoreCase="true" />
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
我的网站
我们可以假设它是apache或nginx:)它是一个.Net MVC网站一个自托管程序或托管在IIS:)