我有一个网站,最近从http感动://到https://问题以https://非www重新定向到https:// WWW
该网站是建立与MVC托管在IIS7上,我知道我应该有4个绑定。
主要原因之一:
https://www.example.com(端口:443 - IP地址:*)
和3人全部到301再直接到以上。
http://www.example.com - (port:80 - ip address: * -re-direct works)
http://example.com - (port:80 - ip address: * -re-direct works)
https://example.com - (port:443 - ip address: * -re-direct does not work)
试图解决为什么底部失败的网站无法到达。服务器DNS地址找不到。
下面是代码我使用的重新定向HTTP到HTTPS
// The base only redirects GET, but we added HEAD as well. This avoids exceptions for bots crawling using HEAD.
// The other requests will throw an exception to ensure the correct verbs are used.
// We fall back to the base method as the mvc exceptions are marked as internal.
if (!String.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase)
&& !String.Equals(filterContext.HttpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase))
{
base.HandleNonHttpsRequest(filterContext);
}
// Redirect to HTTPS version of page
// We updated this to redirect using 301 (permanent) instead of 302 (temporary).
string url = "https://" + filterContext.HttpContext.Request.Url.Host + filterContext.HttpContext.Request.RawUrl;
filterContext.Result = new RedirectResult(url, true);
任何想法是怎么回事错在这里与底部结合?尝试在Google网站站长Search Console上设置第4个媒体资源,并且显然不能由于DNS失败。
任何帮助都非常感谢。干杯
嗨,谢谢你的回复。不幸的是,也没有那种喜悦。 我担心绑定或GoDaddy级别有问题。 我觉得奇怪的是 的http://非www到https:// WWW工作正常 但 https://开头非www到https:// WWW没有。 即使没有重新指导,我也无法获取https://非www的流量来完成所有工作:( – Johnathan
)您是否尝试过[response](http://stackoverflow.com/questions/38883207/url -rewrite-Web的配置-HTTPS的和WWW)? – Camille