Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • VGBenjamin 11 posts 71 karma points
    Oct 08, 2012 @ 07:41
    VGBenjamin
    0

    'Wildcard' url

    Hello,

     

    Is it possible to match all the url without creating it into the backend?

    I need to match every products with a specific url and display a specific page for it. For example, the urls

     - /Products/Product1

     -  /Products/Product2

    ...

     

    Regards,

  • Paul Blair 466 posts 731 karma points
    Oct 08, 2012 @ 21:37
    Paul Blair
    0

    Yes, you can do this by adding the following to your config/urlrewriting.config:

    <add name="accomrewrite"
          virtualUrl="^~/products/(.*)"
          rewriteUrlParameter="ExcludeFromClientQueryString"
          destinationUrl="~/products?search=$1"
          ignoreCase="true" />

    Then in your xslt or Razor script you can access the query string e.g.

    <xsl:variable name="search" >
              <xsl:value-of select="Exslt.ExsltStrings:lowercase(umbraco.library:RequestQueryString('search'))"></xsl:value-of>
        </xsl:variable>

  • VGBenjamin 11 posts 71 karma points
    Oct 09, 2012 @ 07:32
    VGBenjamin
    0

    Ok super I will test it then :)

Please Sign in or register to post replies

Write your reply to:

Draft