Copied to clipboard

Flag this post as spam?

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


  • Eyal 8 posts 29 karma points
    Jan 05, 2014 @ 22:26
    Eyal
    0

    Multi language setup on a single domain

    Hi,

    This topic has been discussed a million times but for some reason I still can't find a proper solution. I'm trying to go with the hostname solution for a multi lingual website. My structure is very simple:

    en

    --home

    --some page

    fr

    --home

    --some page

    etc...

     

    My goal is to have a single domain website and to differentiate between language using the usual .../en/ or .../fr/. so for example, www.site.com/en/home will lead to the english homepage and www.site.com/fr/home will lead to the french one.

    I've set up hostnames/subdomains for all my language root nodes except english. I've set "umbracoHideTopLevelNodeFromPath" to false in my web.config. I've set "useDomainPrefixes" to true under umbracoSettings.config. I don't know if i'm missing anything else.

    The english version the URL generation works fine. In other languages for some reason, when entering @page.Url and @Umbraco.NiceUrl(page.Id) I get the exact same URL which includes my fake subdomain. I would like it to ignore the subdomain thing. I want it to spit out a regular relative url. The one that makes sense according to the node structure. I can't figure out a way to do that. It insists on giving me urls with the fake subdomains. I can write my own url writing function but I feel like it's stupid and there should be a simple solution to this problem.

    Any help will be appreciated!

    Thanks,

    Eyal

  • Anthony Southworth 46 posts 173 karma points
    Jan 09, 2014 @ 15:38
    Anthony Southworth
    0

    Hi Eyal,

    This is definitely working differently in V7 compared to V4.

    In V4 the hostnames/subdomains were displayed in the properties tab as alternative links. I'll post this as a bug.

  • Eyal 8 posts 29 karma points
    Jan 09, 2014 @ 15:51
    Eyal
    0

    Hi Anthony,

    Thanks!

    This whole language tied to domain thing needs to go away. It looks like it should work in this version because you can set a culture to any node without a hostname. But you can't retrieve that language by querying contentService.GetById(node.Id).Language (http://our.umbraco.org/forum/developers/api-questions/43257-Language-=-null-on-contentServiceGetById()). This forced me to add hostnames like www.mysite.com/en and www.mysite.com/fr for now. This also means that my links must be absolute. Kind of frustrating. 

    I tried making my own URL generator that overrides that whole domain thing. All was well until I clicked a page that had umbracoRedirectId in it and it redirected to the fake domain :)

    Hope they fix it soon,

    Eyal

     

     

  • Anthony Southworth 46 posts 173 karma points
    Jan 09, 2014 @ 15:59
    Anthony Southworth
    0

    You can get around this if you enter the hostname as www.site.com/fr but you will have to change it for your local/dev/live sites so not ideal.

    (Posted before I saw you said the same above :)

  • Anthony Southworth 46 posts 173 karma points
    Jan 09, 2014 @ 16:30
    Anthony Southworth
    0

    I've got it working without adding a hostname. Use the Dictionary to add/lookup the language for the page.

  • Eyal 8 posts 29 karma points
    Jan 09, 2014 @ 16:33
    Eyal
    0

    nice!

    i'll give it a try later on tonight. 

    Thanks man!

Please Sign in or register to post replies

Write your reply to:

Draft