Asp.net HTTPS重定向不太正常
我正在使用ASP.NET web.config文件中的以下代码将“www”请求重定向到我的安全网站:Asp.net HTTPS重定向不太正常,asp.net,https,web-config,url-redirection,Asp.net,Https,Web Config,Url Redirection,我正在使用ASP.NET web.config文件中的以下代码将“www”请求重定向到我的安全网站: <rewrite> <rules> <clear/> <rule name="httpsredirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add in
<rewrite>
<rules>
<clear/>
<rule name="httpsredirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{REQUEST_URI}" />
</rule>
</rules>
</rewrite>
"
它们被重定向到
“”
问题是重定向在将它们发送到安全站点时效果很好,但是缺少目标URI,因此它们会被发送到站点的根默认页面。这里有什么帮助吗?谢谢!
现在尝试更改
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{REQUEST_URI}" />
到
如果你查看答案,你会看到他们有url=“https://{HTTP\u HOST}{REQUEST\u URI}”
而不是你的url=“https://{HTTP\u HOST}/{REQUEST\u URI}”
,奇怪的是,他们做到了。我之前尝试过,但运气不好。也许我的字符串中有什么东西(我只是复制并粘贴了你的!)1.非常感谢!
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />