4
就像在標題中一樣。如何重定向整個域,例如:http://testdomain.com.au/到https://testdomain.com.au/我可以在IIRF文件中做到嗎?如果是的話,這應該是什麼樣子?如何將IIRF文件綁定到站點?ASP.NET網站。將整個域從http重定向到https
就像在標題中一樣。如何重定向整個域,例如:http://testdomain.com.au/到https://testdomain.com.au/我可以在IIRF文件中做到嗎?如果是的話,這應該是什麼樣子?如何將IIRF文件綁定到站點?ASP.NET網站。將整個域從http重定向到https
您可以通過IIS Rewrite module
做到這一點:
http://www.iis.net/downloads/microsoft/url-rewrite
http://www.iis-aid.com/articles/how_to_guides/redirect_http_to_https_iis_7
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
或者你也可以通過Global.asax
文件重定向:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (!Request.IsSecureConnection)
{
string path = string.Format("https{0}", Request.Url.AbsoluteUri.Substring(4));
Response.Redirect(path);
}
}
非常感謝。使用IIRF文件怎麼樣? (我只是爲了以防萬一);) – born2fr4g