Copied to clipboard

Flag this post as spam?

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


  • Sjoerd Stottelaar 31 posts 189 karma points
    Apr 23, 2019 @ 14:13
    Sjoerd Stottelaar
    1

    Multilingual website relative URL's

    Hi all!

    I'm building a multilingual website using Umbraco 8 and I'm stuck on getting our local development URL's working properly. The URL's on my website are pointing to the full URL instead of the relative path. So this is what happens:

    http://localhost/en-gb/about-us

    Points to:

    https://www.example.com/en-gb/about-us

    I expect it to point to my local localhost URL instead of the full production URL. This makes navigating on my local environment very tedious.

    Is there a way to make an exception to how the URL's are structured on my local environment? Or is there a best practice for this?

    Many thanks!

  • Bryna 73 posts 259 karma points
    Apr 23, 2019 @ 18:44
    Bryna
    1

    I believe that the umbracoDomain table in the database should be able to get you unstuck. Just replace www.example.com with localhost and you might be good to go.

  • Sjoerd Stottelaar 31 posts 189 karma points
    Apr 24, 2019 @ 06:57
    Sjoerd Stottelaar
    0

    Thanks! Changing something in the database isn't really my cup of tea as a front-end developer, but might consult someone who knows more about it. I was hoping for a nice way to make it work through settings or something, guess it's not possible.

    Thanks!

  • Rhys Hamilton 140 posts 942 karma points
    Apr 24, 2019 @ 08:36
    Rhys Hamilton
    2

    Within the root node of your site - or wherever is applicable - if you right-click it to bring up the properties and click into Culture and Hostnames, you should be able to add or remove domain names.

    So, there shouldn't be any need to access the database - as this can be handled via the front-end.

    I've attached an example image below to give a rough idea of what I mean.

    enter image description here

    Alternatively, if you remove all of the domains it will always use your default locahost.

  • Sjoerd Stottelaar 31 posts 189 karma points
    Apr 24, 2019 @ 11:09
    Sjoerd Stottelaar
    0

    Thanks, this seems a step in the right direction! I now have my local environment working, but Umbraco doesn't seem to understand which language to choose when using two languages.

    enter image description here

    I have included a language selector in my template which lets the user navigate to another language. The language it is referring to is not the right one. How do I make sure that Umbraco picks the right domain when I'm either working local or on production? It seems like it picks one randomly or the first on in the list.

  • Rhys Hamilton 140 posts 942 karma points
    Apr 25, 2019 @ 08:36
    Rhys Hamilton
    0

    When working locally, there's two options that I use (that don't require editing any code):

    • Remove all of my "example" domains so there's only ever 1 domain per language. On my live site, it's usually not too time consuming to switch these back.

    • Keep all of my domains and simply test things out by accessing document types by clicking one of the appropriate URLs under the "Info" icon.

    On local setups, you won't need the official domains and on live you won't need the local ones. So, I'd suggest the first option.

    This is just what works for me though, so there's probably better ways to do this - but this would probably require some changes to the code itself.

Please Sign in or register to post replies

Write your reply to:

Draft