Copied to clipboard

Flag this post as spam?

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


  • Johan Dahlström 33 posts 146 karma points
    Mar 19, 2021 @ 08:08
    Johan Dahlström
    0

    Get content by route with multiple domains

    I have 2 languages added to my site, Swedish and Danish. I've created a start page as root node for my content and added 2 domains in Cultures and Hostname, /da and /sv.

    If I look at the route for the route for the content for the Swedish start page, it says /sv/.

    I'm using UmbracoContext.Content.GetByRoute, in order to find the content. I need to pass (preview: false, route: "/", culture: "sv") in order to find it. Why is /sv omitted from the route?

    I've also seen examples of the domain root id needing to be a prefix for the route, e.g. 1056/sv/, does that only apply for multiple root nodes?

    Thanks in advance :)

  • Alex Skrypnyk 6175 posts 24176 karma points MVP 8x admin c-trib
    Mar 23, 2021 @ 21:54
    Alex Skrypnyk
    0

    Hi Johan

    What Umbraco version are you using? Are you using "addTrailingSlash" setting?

    Check that you don't have rewrite rules that change URL and custom URL providers.

    Thanks,

    Alex

  • Johan Dahlström 33 posts 146 karma points
    Mar 23, 2021 @ 22:01
    Johan Dahlström
    0

    Hi Alex,

    I use Umbraco v8.12.1 and I haven't modified umbracoSettings.config, so I don't think addTrailingSlash is enabled?

    I do have a custom content finder added first to the content finder chain though, could that affect UmbracoContext.Content.GetByRoute?

    My rewrite rules are for UCommerce:

    <rewrite>
      <rules>
        <rule name="UcommerceCategoryRewrite">
          <match url="(.*?)/c/(.+/)*(.*)" />
          <action type="Rewrite" url="catalog.aspx?catalog={R:1}&amp;categories={R:2}&amp;category={R:3}" />
        </rule>
        <rule name="UcommerceProductRewrite">
          <match url="(.*?)/p/(.+/)*(.*)" />
          <action type="Rewrite" url="catalog/product.aspx?catalog={R:1}&amp;categories={R:2}&amp;product={R:3}" />
        </rule>
        <rule name="UcommerceVariantRewrite">
          <match url="(.*?)/v/(.+/)*(.*)/(.*)" />
          <action type="Rewrite" url="catalog/product.aspx?catalog={R:1}&amp;categories={R:2}&amp;product={R:3}&amp;variant={R:4}" />
        </rule>
      </rules>
    </rewrite>
    
Please Sign in or register to post replies

Write your reply to:

Draft