阅读背景:

301 redirect Domain Name using global.asax

来源:互联网 

 

void Application_BeginRequest(object sender, EventArgs e)
{


if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("https://domain.com"))
{
// new line here
HttpContext.Current.Response.Clear();
//
HttpContext.Current.Response.Status = "301 Moved Permanently";
HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("https://domain.com", "https://www.domain.com"));
}


}void Application_BeginRequest(object se



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: