Copied to clipboard

Flag this post as spam?

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


  • G X 6 posts 37 karma points
    Dec 17, 2012 @ 03:58
    G X
    0

    Mapping wildcard paths for routing in Umbraco

    Hi there,

    I'm updating a legacy site to use Umbraco. For its product inventory, it uses URLs such as the following:

    http://tempuri.org/product/toy-mouse

    http://tempuri.org/product/inflatable-duck-with-hat

    http://tempuri.org/product/talking-scorpion

    The challenge is to upgrade the site and retain these URLs - including the legacy display of products, and mapping between the slug (e.g "toy-mouse") and the product.

    I've created a page called "Product" in Umbraco, and on this page I embed a user control which displays the Product details just as they were in the old system. But how do I point "product/*" to this page, where "*" is anything?

    If I use a query string parameter instead (e.g. tempuri.org/product?toy-mouse) this is easy, but as mentioned above I must retain the original URLs.

    Your help is hugely appreciated!

    Gary

    (apologies if this shows up twice; my line breaks were munged and the editing feature currenty breaks on submit)

  • G X 6 posts 37 karma points
    Dec 19, 2012 @ 11:12
    G X
    0

    Hi again,

    Can anyone point me in the right direction to figure out this issue?

    All advice massively appreciated and desperately sought :)

    Gary

  • Stephen Roberts 47 posts 516 karma points c-trib
    Dec 19, 2012 @ 11:24
    Stephen Roberts
    100

    This should be possible by using url rewriting, you could play around with that.

    in the config file UrlRewriting.config add something like

    <add name="ProductRewite" virtualUrl="~/product/(.*)$" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="/product?name=$1" ignoreCase="true" />

     

    Hope this helps!

  • G X 6 posts 37 karma points
    Dec 23, 2012 @ 22:04
    G X
    1

    Thanks Stephen Roberts, you cool cat.

Please Sign in or register to post replies

Write your reply to:

Draft