More in this section
Forums / Suggestions / Redirect URLs without 'www' to with 'http://www...' using Global.asax in Sitefinity websites

Redirect URLs without 'www' to with 'http://www...' using Global.asax in Sitefinity websites

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Developer
    Developer avatar
    1 posts
    Registered:
    28 Jul 2008
    08 Jul 2009
    Link to this post
    Here's a code snippet to do this

    protected void Application_EndRequest(object sender, EventArgs e)
    {

        if (!(Request.Url.AbsoluteUri.ToLower().Contains("www")))
        {
          Response.Redirect(Request.Url.AbsoluteUri.Replace("http://", "http://www."));
         }

          

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    08 Jul 2009
    Link to this post
    Hello Developer,

    Thank you for sharing this code with us.

    Another good solution is using built in AdvancedUrlRewriter.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered