@{dom
var domain = "www." + helpers.Domain();io
var host = Request.Url.Host;ast
var AbsolutePath = Request.Url.AbsolutePath;註釋
if (domain != host)兼容
{co
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "http://www.mastersws.com" + AbsolutePath);
}
}
註釋:爲了兼容ie,帶www的爲200 ,非www爲301。 同時也避免了本身跳轉本身。