Redirect to website without www.


/ Published in: C#
Save to your folder(s)

Add this code to your Global.asax in your ASP.NET project, in the \"Application_BeginRequest\" event.


Copy this code and paste it in your HTML
  1. if (HttpContext.Current.Request.Url.ToString().ToLower().StartsWith("http://www"))
  2. {
  3. Response.Redirect("http://WEBSITE.COM" + HttpContext.Current.Request.RawUrl.ToString());
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.