Copied to clipboard

Flag this post as spam?

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

  • Jojo V 20 posts 101 karma points
    Jul 18, 2019 @ 08:45
    Jojo V


    I look for how to get content (ideal from cache) by URL with multiple hostnames in custom API controller UmbracoApiController. I was find method UmbracoContext.Content.GetByRoute but I don't know how to get content for specific hostname / domain.

    For example, how find content for and Content this pages is not the same.

    If i set this url to parameter in function UmbracoApiController then I always getnull or error.


  • Marc Goodson 1027 posts 6801 karma points MVP 4x c-trib
    Jul 20, 2019 @ 23:53
    Marc Goodson

    Hi Jojo

    If you have specific multiple custom hostnames set on your Umbraco site to different root nodes in the content tree - then you can still use GetByRoute..

    but you need to prefix the relative path you are looking for with the id of the Root node for that site domain..

    So GetByRoute("1234/en/home") and GetByRoute("1235/en/home")

    where 1234 is the id of root node for one site, and 1235 is the root node for another...

    I know this is a V7 package PageNotFoundManager by TimGeyssens, but this code gives you a bit of a gist of how the GetByRoute works in a multi site Umbraco implementation.

    Hope that helps steer in the right direction.



Please Sign in or register to post replies

Write your reply to: