Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将配置从HTTP重写为HTTPS无效_C#_.net_Url Rewriting - Fatal编程技术网

C# 将配置从HTTP重写为HTTPS无效

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

在我的.Net MVC网站中,如何添加重写规则以将我的网站url从http重定向到url为“”的网站的https

此外,我的网站几乎没有像“”和“”这样的其他域。我想添加重定向规则,以便仅将“”url重定向到“”

我正在web.Config文件中尝试以下规则,但它不起作用

<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:)