Copied to clipboard

Flag this post as spam?

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

  • ianhoughton 233 posts 443 karma points c-trib
    Nov 01, 2017 @ 09:32

    We have a single site with where we have set multiple hostnames on the home node:

    The issue we have is if you view the site on, some of the navigation is returning the links with in the url instead of

    We're creating the navigation using:

    var parent = Model.Content.AncestorOrSelf(2);
    var pages = parent.Children.Where(x => x.IsVisible());

    When dubugging the site running on, the Url for Model.Content is which happens to be the first Url on the properties tab for the Home node.

    Is this expected behaviour, how can we get it to respect the domain that your viewing the site on?

  • Dan Diplo 1470 posts 5656 karma points MVP 3x c-trib
    Nov 01, 2017 @ 13:24
    Dan Diplo

    Firstly, I wouldn't do this, as you'll then have the same content being served on multiple domains. I'd map only one site and then use redirects in IIS/Web.config to redirect all the other domains to your prefered "canonical" domain.

    But if you are determined, then you can utilise Events in Umbraco You'll need to create a class that inherits from IApplicationEventHandler, as described in the docs. Then you can use the SiteDomainHelper class (in Umbraco.Web.Routing namespace) to register your prefered domain. See at the bottom of

    protected override void ApplicationStarting(…)
        SiteDomainHelper.AddSite("default", "");
  • ianhoughton 233 posts 443 karma points c-trib
    Nov 01, 2017 @ 14:30

    The 2 sites serve different content from a CRM, but the structure and templates are shared.

    I think the issue was that the dev site runs on http and not https, but the hostname was https.

  • John Bergman 450 posts 1054 karma points
    Nov 01, 2017 @ 14:23
    John Bergman

    I'd be curious as to why you would do this, are you wanting to change the behavior between members and customers - if that is the case using member groups would be a better solution?

    Also, why would you have seemingly test instances inside your live umbraco instance?

Please Sign in or register to post replies

Write your reply to: