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

Url rewriting

3 posts, 0 answered
  1. Jason Grovert
    Jason Grovert avatar
    28 posts
    Registered:
    25 Oct 2005
    08 Feb 2007
    Link to this post
    I've not heard anything mentioned as to whether or not this will be supported in 3.0.  I cannot find any mention of it in the current docs either.  Thanks!
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    09 Feb 2007
    Link to this post
    Yes Jason,

    The URL Rewriter will be supported in Sitefinity 3.0. You will be able to use the same rule base URL rewriting as in version 2.7. It will be included in the upcoming Sitefinity 3.0 release candidate. As in previous versions, the URL Rewriter is switched OFF by default. To switch it ON, you need to do the following changes in the Web.config file:

    1. Add a configuration section element (<configSections>):
    <configuration>

     <configSections>
      <sectionGroup name="telerik">
        ...
        <section name="urlrewrites" type="Telerik.Cms.Web.AdvancedUrlRewriter, Telerik.Cms"/>
      </sectionGroup>
     </configSections>

    1. Replace the default CmsHttpModule with CmsHttpModuleUrlRewrite (shipped with Sitefinity).

    Change these lines:

    <httpModules>
     <add name="Cms" type="Telerik.Cms.Web.CmsHttpModule, Telerik.Cms"/>
    </httpModules>

    With:

    <httpModules>
     <add name="Cms" type="Telerik.Cms.Web.CmsHttpModuleUrlRewrite, Telerik.Cms"/>
    </httpModules>

    1. Add an <urlrewrites> section:
    <configuration>
     <telerik>
     …
      <urlrewrites>
       <!-- Add your rule elements here -->
       <rule>
        <url>[input URL pattern]</url>
        <rewrite>[replaced URL]</rewrite>
       </rule>
      </urlrewrites>

    This section sets the rules for rewriting the URLs. You can add one or more rules here. Rewriting is based on the regular expressions technology (more details you can find here). It is similar to using the RegEx.Replace() method in .NET and <url> is a pattern expression and <rewrite> is a replacement string.

    Example:

    If you have a products page (products.aspx) that will manage each product, requesting a Product Id (ProdId) in the query string, and you want to access each product without using a query string, you may have the following rule in <urlrewrites>:

    <urlrewrites>
     <rule>
      <url>product(.*)\.aspx</url>
      <rewrite>Products.aspx?ProdId=$1</rewrite>
     </rule>
    </urlrewrites>

    This will rewrite the URLs in the following manner:

    URL

    Will be rewrited to:

    product1.aspx products.aspx?ProdId=1
    product2.aspx products.aspx?ProdId=2
    productAny.aspx products.aspx?ProdId=Any

     
    Also, except the above advanced method Sitefinity 3.0 will provide 2 other ways to Rewrite URLs, which do not require changes in the Web.config:

    1. You can specify more than one URL for a page from Page Properties (Friendly URLs)
    2. Setting the regular expression rule for a page URL directly from the Page Properties UI (will not be included in the RC)

    Greetings,
    Vlad
    the telerik team

  3. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    21 May 2008
    Link to this post
    how do I acheive the reverse of url rewriting? I am using the category list and it is showing a list of categories for generic content, but the links are coming out with querystrings instead of being rewritten. how do I get them to rewrite the urls to use the category name instead of the querystring id?

    thanks
Register for webinar
3 posts, 0 answered