Multi-site configuration with multiple host names per root node
I'm working on a multi-site configuration (not multilingual). The development and staging environments are using the same database. I've assigned multiple host names to the root node of each website, one for development and one for staging, for example:
Website A
websitea.local (dev)
websitea.staging.io (staging)
Website B
websiteb.local (dev)
websiteb.staging.io (staging)
When linking between these sites the absolute URL is obviously different based on the environment and this leads to problems because Umbraco doesn't know which host name it should be using to create the absolute URL. Is there an easy way to help Umbraco figure out which absolute URL / host name to use when linking between sites based on the environment it's running on?
Essentially, Umbraco uses an implementation of this when calculating Urls, it ships with a 'DefaultSiteDomainMapper' that might be all you need to group the URLs of sites together.
That should mean that when you are 'on websitea.staging.io and there is a link to siteb, it will know to make it via websiteb.staging.io and not the local one.
But you can create an implementation of ISiteDomainMapper if you need to do something super complex.
Multi-site configuration with multiple host names per root node
I'm working on a multi-site configuration (not multilingual). The development and staging environments are using the same database. I've assigned multiple host names to the root node of each website, one for development and one for staging, for example:
Website A
Website B
When linking between these sites the absolute URL is obviously different based on the environment and this leads to problems because Umbraco doesn't know which host name it should be using to create the absolute URL. Is there an easy way to help Umbraco figure out which absolute URL / host name to use when linking between sites based on the environment it's running on?
Hi Arjan
Have a look at ISiteDomainMapper
https://docs.umbraco.com/umbraco-cms/reference/routing/request-pipeline/outbound-pipeline#site-domain-mapper
Essentially, Umbraco uses an implementation of this when calculating Urls, it ships with a 'DefaultSiteDomainMapper' that might be all you need to group the URLs of sites together.
That should mean that when you are 'on websitea.staging.io and there is a link to siteb, it will know to make it via websiteb.staging.io and not the local one.
But you can create an implementation of ISiteDomainMapper if you need to do something super complex.
regards
Marc
Awesome! Sound like this is exactly what I need. I'll check it out.
Works like a charm! Thanks!!!
is working on a reply...