Copied to clipboard

Flag this post as spam?

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


  • Carlos Casalicchio 139 posts 572 karma points
    Aug 19, 2019 @ 14:29
    Carlos Casalicchio
    0

    Cultures and Hostnames issue with Request URL

    I am developing a multi-tenant project for a client. The tenant sites support multi-languages, and several child pages.

    When multiple tenants are created, I don't need to set Cultures and Hostnames because the subdomains are always different.

    For example:

    test1.url.com test2.url.com test3.url.com

    But, since all the children will have the same relative paths, the child pages return errors "This document is published but its url would collide with content /Umbraco Test 40/Sport (id=1484)"

    By setting the cultures and hostnames, the issue does not happen. But then it seems that Umbraco starts ignoring the Request Url, and always opens the first tenant's site.

    The client is using Cloudflare for DNS and caching, and has not setup any type of IIS bindings (one of their requirements it to NOT have IIS bindings).

    I'm having a hard time figuring this one out. Any suggestions, Or, am I doing something wrong?

    I have set a personal VPS (I'll leave on for now), and the languages work, and the child pages work (i've only set the sports page for now) https://test1.totalbettingtest.tk/

    https://test2.totalbettingtest.tk/

    https://test3.totalbettingtest.tk/

    https://test4.totalbettingtest.tk/

    But I have set the IIS bindings, and it all works. So, I'm not sure how to make it work without the IIS bindings.

    IIS Bindings

  • Alex Skrypnyk (skrypnyk.dev) 6070 posts 23408 karma points MVP 6x admin c-trib
    Sep 02, 2019 @ 21:10
    Alex Skrypnyk (skrypnyk.dev)
    0

    Hi Carlos

    Did you solve this issue?

    Alex

  • Carlos Casalicchio 139 posts 572 karma points
    Sep 03, 2019 @ 13:53
    Carlos Casalicchio
    100

    Hi Alex,

    Yes, the client figured out that the issue was in their SSL configuration, it had nothing to do with umbraco or IIS. They wanted to avoid doing IIS bindings for each site, so they had a complex setup with CloudFlare for caching and DNS, which was making me suspicious the issue was the CDN.

    But it turned out it was all in their SSL configuration, once they figured it out, everything started working without even needing to set an IIS binding for each site.

    I was relieved :)

  • Mona 36 posts 106 karma points
    Jul 08, 2021 @ 08:51
    Mona
    0

    Dear Carlos, I'm facing issue with Umbraco Multi language website English & Arabic. English (en-US) is working fine as default language. Arabic (ar-SA) secondary language is not working, showing 404 error, page does not exist. Domains setting with Culture and Hostnames http://localhost:4865 http://localhost:4865/ar

    I followed all steps of this link: https://www.youtube.com/watch?v=-vzxCdjq4FM&ab_channel=UmbracoHQ enter image description hereenter image description hereenter image description hereenter image description hereenter image description here

    Please assist.

  • Carlos Casalicchio 139 posts 572 karma points
    Jul 08, 2021 @ 15:15
    Carlos Casalicchio
    0

    Have you tried adding /en to the main culture (English)?

  • Mona 36 posts 106 karma points
    Jul 11, 2021 @ 05:48
    Mona
    0

    Dear Carlos,

    I tried, same issue by using /en

  • Carlos Casalicchio 139 posts 572 karma points
    Aug 27, 2021 @ 12:13
    Carlos Casalicchio
    0

    Sorry for the late reply,

    Remove the http://localhost:4865 from the URL, leave only /ar and /en and see if it works.

  • Mona 36 posts 106 karma points
    Aug 29, 2021 @ 05:23
    Mona
    0

    Thanks Carlos. I did the same and it worked.

    I 'm facing another issue, i would like to attach new css and it will be use as per culture (language) selection i.e. when user select English language then english.css should be use and when user select Arabic language then arabic.css should be use by the website.

    I am not an Umbraco professional, please assist me in a easier way.

    Thanks

  • Carlos Casalicchio 139 posts 572 karma points
    Aug 29, 2021 @ 16:09
    Carlos Casalicchio
    0

    This is the easiest way, done directly in Razor

    @{
        var culture = System.Threading.Thread.CurrentThread.CurrentCulture;
        string css = "style-" + culture.Name + ".css"; // which translates into style-en-US.css
        <link rel="stylesheet" href="/css/@css">
    }
    

    Name your stylesheets based on the culture name (i.e 'en-US', 'ar-FA', etc)

    If you want to use only two letters for the language, use

        string css = "style-" + culture.TwoLetterISOLanguageName + ".css"; // which translates into style-en.css
    

    Name your stylesheets based on the two-letter ISO name (i.e 'en', 'ar', etc)

  • Mona 36 posts 106 karma points
    Aug 31, 2021 @ 10:24
    Mona
    0

    Dear Carlos,

    Thanks for the quick reply. Please check the attached screenshot of master.cshtml where i've linked current English css file named master.css. Could you please let me know how to place the script you provided me.

    enter image description here

    Thanks

  • Carlos Casalicchio 139 posts 572 karma points
    Aug 31, 2021 @ 11:14
    Carlos Casalicchio
    0

    Place it right after your for each loop, replace the link for the master.css

    @foreach (var (culture, infos) in Model.Cultures)
    {
       <link rel="alternate" href="@(Model.Url(culture))" hreflang="@(culture)" />
    }
    
    @{
    
        var culture = System.Threading.Thread.CurrentThread.CurrentCulture;
        string css = "master-" + culture.Name + ".css"; // which translates into style-en-US.css
        <link rel="stylesheet" href="/css/@css">
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft