canonical domain
In the Global.asax file, add the following to the Application_BeginRequest() method.
void Application_BeginRequest(Object source, EventArgs e) { HttpApplication app = (HttpApplication)source; // IMPORTANT! Replace this with your domain name: string domainName = "thedomain.com"; if (app != null) { string host = app.Request.Url.Host.ToLower(); string requestUrl = app.Request.Url.PathAndQuery; if (String.Equals(host, domainName, StringComparison.CurrentCultureIgnoreCase)) { Uri newURL = new Uri(app.Request.Url.Scheme + "://www." + domainName); // This should match what is setup as the default document on the site if (requestUrl.ToLower() != "/default.aspx") { String dest = requestUrl.ToLower().Replace("default.aspx", ""); newURL = new Uri(app.Request.Url.Scheme + "://www." + domainName + dest); } app.Context.Response.RedirectLocation = newURL.ToString(); app.Context.Response.StatusCode = 301; app.Context.Response.End(); } } }