More in this section

Forums / Developing with Sitefinity / How to redirect set of urls using sitefinity

How to redirect set of urls using sitefinity

2 posts, 0 answered
  1. Venkat
    Venkat avatar
    105 posts
    Registered:
    20 Nov 2008
    28 Apr 2009
    Link to this post
    Hi

    We are reconstructing an existing web site.As we are using sitefinity for this,some links urls got changed.

    So that we want to redirect the users to the correct page even if they access this site with the old url.

    and in our old web site all web pages are of html ,where as in sitefinity all pages are aspx.

    How can i redirect the users that accedd the page

    http:mysite.come/emp.html to http://mysite.com/emp.aspx

    Thanks
    Venkat
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Apr 2009
    Link to this post
    Hi Venkat,

    There are two options that you can use.

    1.HttpModule that handle html requests.

    public class MyHttpModule :IHttpModule  
    {  
        public MyHttpModule()  
        {  
            //  
            // TODO: Add constructor logic here  
            //  
        }  
        #region IHttpModule Members  
      
        public void Dispose()  
        {  
              
        }  
      
        public void Init(HttpApplication context)  
        {  
            context.BeginRequest += new EventHandler(context_BeginRequest);  
        }  
      
        void context_BeginRequest(object sender, EventArgs e)  
        {  
            HttpContext mycontext = HttpContext.Current;  
            if (mycontext.Request.RawUrl.Contains("/domain/Default.html"))  
            {  
                string redirectUrl = mycontext.Request.Url.ToString().Replace("/domain/Default.html""domain/default.aspx");  
                mycontext.Response.Redirect(redirectUrl);  
            }  
        }  
        #endregion  
    }  
      
     


    2. Sitefinity's AdvancedUrlRewriter.

    AdvancedUrl rewriter is turned off by default. It have to be enabled. You may have many rules, but they are executed form the top to the end.  For more information about the rules and using the rewriter check our User Manual, URL Rewriting.

    All the best,
    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