I have tried using both of these methods:
void Application_BeginRequest(object sender, EventArgs e)
{
string FromHomeURL = "http://website.com";
string ToHomeURL = "http://www.website.com";
if (HttpContext.Current.Request.Url.ToString().ToLower().Contains(FromHomeURL))
{
HttpContext.Current.Response.Status = "301 Moved Permanently";
HttpContext.Current.Response.AddHeader("Location",
Request.Url.ToString().ToLower().Replace(FromHomeURL, ToHomeURL));
}
}
and this way:
pr ...
Go to the complete details ...