Copied to clipboard

Flag this post as spam?

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


  • Nirmit 24 posts 97 karma points
    Jan 21, 2015 @ 05:49
    Nirmit
    0

    How to change default route in Umbraco7

    Hi,

    I am setting up Umbraco for multi-language site under one domain. however I want to keep single tree only so I am using Vorto extension for multi-language.So far it looks good. However, my requirement is I want to have URL in this format: http://my.domain.com/<lang>/...
    (e.g.,
    http://my.domain.com/en/shop-locations/shop-in-sydney
    http://my.domain.com/zh/shop-locations/shop-in-sydney
    In both case, the request should go to the same content node.)

    The challenge is I cant have an additional node for 'en' or 'zh' in my content tree. So (I believe) the only option is to change the default route to indicate the 1st section of the url is language.

    I tried to search how to change/re-configure the default route but no luck so far. Any help is appreciated.

    Thanks, Nirmit

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 21, 2015 @ 06:13
  • Nirmit 24 posts 97 karma points
    Jan 21, 2015 @ 06:23
    Nirmit
    0

    Thanks Jan for the quick reply. I went through route hijacking, but its not useful in my case.

    • I dont want to add any custom Controller. All request still needs to be passed to/processed by default Controller.
    • {lang} attribute needs to be injected in all URLs across site. So its not possible to have a custom controller per document type. (If thats not the case then probably I can create a bunch of custom routes and it can solve my problem)

    Hope this will clarify my requirement further.

    thanks.

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Jan 21, 2015 @ 08:44
    Jeavon Leopold
    1

    If you really want to have Urls in this structure then I think you will need to use a IContentFinder for this, however I don't think its a documented interface but there is a example in the Hybrid Framework here.

    You will likely want to compliment the content finder with a url provider which is documented here Again there is a example in the Hybrid Framework here

    Good luck!

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Jan 21, 2015 @ 08:56
    Jeavon Leopold
    0

    I found a little documention on IContentFinder here

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jan 21, 2015 @ 12:09
    Jeroen Breuer
    1

    I also wrote a blog about the UrlProvider and ContentFinder: http://24days.in/umbraco/2014/urlprovider-and-contentfinder/

    Jeroen

  • Nirmit 24 posts 97 karma points
    Jan 22, 2015 @ 23:51
    Nirmit
    1

    Thanks Jeroen for useful articles. Its still not exactly what I want to achieve; but nearly there. For a meanwhile I managed to control language selection by using cookies; so not changing URLs for language selection (just to limit the scope of my project).

    Thanks for your help.

  • Łukasz Koruba 30 posts 151 karma points
    Dec 08, 2017 @ 09:42
    Łukasz Koruba
    0

    Have someone resolved this issue?

    I'm also struggling to put language into the URL and I don't want to put this in the cookie.

Please Sign in or register to post replies

Write your reply to:

Draft