+1-888-365-2779
Try Now
More in this section

Forums / 3.x Pre-release forums (retired) / URL Rewriting in SF3 RC1

URL Rewriting in SF3 RC1

4 posts, 0 answered
  1. Francis Spor
    Francis Spor avatar
    6 posts
    Registered:
    15 May 2006
    13 Apr 2007
    Link to this post
    In an earlier forum about SF3, Beta something, there was mention of SF RC1 supporting URL Rewriting. I'm all good with it, except for the step "Replace the CMSHttpModule with the CMSHttpModuleUrlRewrite".  Does this CMSHttpModuleUrlRewrite exist, and if so, where?

    Thank you,
    Francis 
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    16 Apr 2007
    Link to this post
    Hi Francis,

    The type Telerik.Cms.Web.CmsHttpModuleUrlRewrite exists in the Telerik.Cms assembly and all you need to do is described in this forum.
    Please let us if you experience any problems.

    All the best,
    Vlad
    the telerik team

    Instantly find answers to your questions at the new telerik Support Center
  3. Francis Spor
    Francis Spor avatar
    6 posts
    Registered:
    15 May 2006
    16 Apr 2007
    Link to this post
    Alright, very cool.  I've got that up and running.  Now, for the trickier part.  Can it rewrite hosts?  For example, I need to have multiple domain names point to different pages inside of my single sitefinity site.  Let's say I've got domain1.com as my primary SF site.  I need domain2.com to rewrite to domain1.com/Domain2/Domain2.aspx.  Are the rewrite tools in place able to do this?

    Thanks,
    Francis
  4. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    16 Apr 2007
    Link to this post
    Hello Francis,

    This rewriter cannot rewrite domains. Actually, the domains cannot be rewritten and you should use redirect to move from one domain to another.

    Here is the implementation of the Telerik.Cms.Web.CmsHttpModuleUrlRewrite:

    public class CmsHttpModuleUrlRewrite : CmsHttpModule
    {
        protected override string GetUrl(HttpContext context)
        {
            return AdvancedUrlRewriter.GetRewritedURL(base.GetUrl(context));
        }
    }

    I suggest you create your own http module, for example you can implement something like this:

    public class CustomHttpModule : CmsHttpModule
    {
        protected override string GetUrl(HttpContext context)
        {
            if (context.Request.Url.Host.Equals("domain2", StringComparison.OrdinalIgnoreCase) &&
                Path.GetFileName(context.Request.Path).Equals("default.aspx", tringComparison.OrdinalIgnoreCase))
            {
                context.Response.Redirect(
    http://domain1.com/Domain2/Domain2.aspx);
                return null;
            }
            return base.GetUrl(context);
        }
    }

    I hope this will help. Please let us know of you need further assistance.


    Kind regards,
    Vlad
    the telerik team

    Instantly find answers to your questions at the new telerik Support Center
Register for webinar
4 posts, 0 answered