I have a multi site setup with 2 sites in the same installation. The first site has 2 different host bindings, www.mydomain.ch and sub.mydomain.ch, both bindings are configured in EPiServer admin and the www domain is the main domain. When visiting the site with the www or sub domains the links are rendered correct (as relative links in the html source so when you click on them you are still on the same domain) but now when I have added another site with two new host bindings, www.mydomain.fi and sub.mydomain.fi, also here with www as the main domain, all links on the site are rendered to sub.mydomain.fi even when I visit the site using the www domain. Have I missed some configuration here? The links are renderd with the Url.PageUrl, Url.ContentUrl etc.
Have you added language mappings for all your hosts?
That is: Is both www.mydomain.fi and sub.mydomain.fi mapped to language "fi"?
Also which version are you running on? There was some bugfix done in this area somewhere around CMS.Core7.10 or 7.11 I think it was.
Yes all hosts are connected to a specific langauge (same for all hosts on the same site). I run CMS 7.12 and Commerce 7.11.
When it determines which host to use for a specific language it will just take the first host matching the langauge in the list. So if you change the order of hosts www.mydomain.fi and sub.mydomain.fi in the host list I think it should work.
I know there is no other way to change the order than to remove them and then add them in a specific order. We will look into this and either add sorting or a way to specify hosts (like saying "this host is my main host for this language").
Ok, but can't I have two hosts for the same site then without the links being rewritten to one of the hosts? Why does it work for one of the sites but not for the other?
As it works when a link to a content item is constructed is that it will get all hosts that has a mapping to the language.
If none it will be a relative link (with a language segment if more than one language is enabled)
If there are hosts it will se if the current host is in the list then it will be a relative link (without language segment). If current host is not in list it will take first host in list.
If the link is to another site (in a multi-site scenario) then it will take the first host that matches the language.
Could it be that for the working site is the www host first in the host list while it is not on the other site?
After a upgrade of the site to version 8.5 for Commerce and 7.18 of EPiServer this issue has been solved.