More in this section

URL Rewriting

4 posts, 0 answered
  1. Chris Wilper
    Chris Wilper avatar
    13 posts
    Registered:
    01 Sep 2009
    21 Oct 2009
    Link to this post
    I'm trying to ge the url rewriting working in my environment.  I've made the following changes to the web.config file and nothing is happening to the url. 
      
       <sectionGroup>
           <section name="urlrewrites" type="Telerik.Cms.Web.AdvancedUrlRewriter, Telerik.Cms"/>
       </sectionGroup> 

       <httpModules>
          <add name="Cms" type="Telerik.Cms.Web.CmsHttpModuleUrlRewrite, Telerik.Cms"/>
      </httpModules>
      
       <urlrewrites>
          <rule>
            <url>/FranchiseHome\.aspx?location=(\B+)</url>
            <rewrite>/FranchiseHome/$1.aspx</rewrite>
          </rule>
        </urlrewrites>



    The starting url is "http://??????.com/Franchises/FranchiseHome.aspx?location=Boulder"

    I need to to be rewritten to "http://??????.com/Boulder-homecare"
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Oct 2009
    Link to this post
    Hello Chris Wilper,

    The AdvancedUrlRewriter does not make redirect. It works in this way:
     If someone enter the following url - /FranchiseHome\.aspx?location=(\B+) - the rewriter makes internal replacement and you see the page behind /FranchiseHome/$1.aspx. If  you need to redirect any url you can use IHttpHandler with regular expression.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Chris Wilper
    Chris Wilper avatar
    13 posts
    Registered:
    01 Sep 2009
    22 Oct 2009
    Link to this post
    Ok,
        That may still work for me.  I'm having problems with the syntax.  How would I do the following.

        incoming url's
        http://???/Boulder-homecare
        
    http://???/Boulder

        I need to route both the urls above to the following
        http://???/franshises/franshisehome.aspx?location=Boulder

    I just not sure on how to write the rule to accomplish this.
  4. Mr. Plinko
    Mr. Plinko avatar
    13 posts
    Registered:
    16 Jul 2009
    24 Oct 2009
    Link to this post
    The simple way to redirect is:
        protected void Page_Load(object sender, EventArgs e) 
        { 
             Response.Redirect("http://???/franshises/franshisehome.aspx?location=Boulder"
        } 

    :-P

    Do you want http://???/Boulder to be in the URL with the content of http://???/franshises/franshisehome.aspx?location=Boulder or the long version in the URL?

    PS if you haven't seen it, you should check out the Webinar on URL Rewriting
Register for webinar
4 posts, 0 answered