I thought it depends on which of these domains you're currently visiting...
So if you have domain1.com and domain2.com and you're visiting domain1.com, it returns all url's with domain1.com. That's what I've experienced with our websites.
I just had a look at the source and umbraco prefers using the current domain (if it fails, the first domain returned by the API will be used):
if (UmbracoSettings.UseDomainPrefixes) { Domain[] domains = Domain.GetDomainsById(nodeId); // when there's a domain on a url we'll just return the domain rather than the parent path if (domains.Length > 0) { if (currentDomain != String.Empty) { foreach (Domain d in domains) { // if there's multiple domains we'll prefer to use the same domain as the current request if (currentDomain == d.Name.ToLower()) parentUrl = "http://" + d.Name; } } if (parentUrl == String.Empty) { parentUrl = "http://" + domains[0].Name; } return parentUrl; } }
So that's not the problem. What might be the problem, is that 'currentDomain' equals:
Thanks for the pointers. I just checked and SERVER_NAME equals the domain that I'm accessing the website with. And this domain also exist among the 11 domains registered on the root.
I also checked that UseDomainPrefixes is true, and it is.
I found something else. I logged into umbraco using the domain I want the site to use. I opened the node and on the general properties tab it showed all the domain nodes configured. The top one being the "link to document" with the wrong domain that the site returns in NiceUrl calls for all pages. And the "right domain is listed below in the list of alternate links.
I then published this page. The "Link to document" was changed to correct domain - the domain I logged in with.
So - it seems that Umbraco NiceUrl uses the last domain I published the site with and not the current domain?
Has there been any resolve in this issue? I have a multi domain setup as well and see the same issue that Jesper described. Is there no way to force niceurl to use virtual/relative url's rather than select from the available alternate domains?
For me it seems to depend on the domain you are connected with when editing content or publishing the site.
If i am right, in a multisite umbraco deployment, you should avoid republishing the entire site or you will get for all sites the same domain in the link to document.
In this case NiceUrl sometimes fails to return the good host.
Anyway it is strange to have an inconsistent response, as I saw the host in the links swapping randomly when navigating inside a site.
How to configure which domain NiceUrl should return?
Root node on website is configured with 11 (yes) domains. For some reason NiceUrl returns the 3rd of them which is exactly the one I dont want.
How do I change that?
Best
Jesper
I thought it depends on which of these domains you're currently visiting...
So if you have domain1.com and domain2.com and you're visiting domain1.com, it returns all url's with domain1.com.
That's what I've experienced with our websites.
I thought the same. But not here. There most be some way to control this.
Btw Im using 4.7.
Best
Jesper
No - Republish entire site doesnt help :-)
I just had a look at the source and umbraco prefers using the current domain (if it fails, the first domain returned by the API will be used):
So that's not the problem.
What might be the problem, is that 'currentDomain' equals:
HttpContext.Current.Request.ServerVariables["SERVER_NAME"]
Personally I would have use HTTP_HOST instead of SERVER_NAME: http://shiflett.org/blog/2006/mar/server-name-versus-http-host
Maybe you can Response.Write this SERVER_NAME to see what it returns...
Thanks for the pointers. I just checked and SERVER_NAME equals the domain that I'm accessing the website with. And this domain also exist among the 11 domains registered on the root.
I also checked that UseDomainPrefixes is true, and it is.
I found something else. I logged into umbraco using the domain I want the site to use. I opened the node and on the general properties tab it showed all the domain nodes configured. The top one being the "link to document" with the wrong domain that the site returns in NiceUrl calls for all pages. And the "right domain is listed below in the list of alternate links.
I then published this page. The "Link to document" was changed to correct domain - the domain I logged in with.
So - it seems that Umbraco NiceUrl uses the last domain I published the site with and not the current domain?
Is this the way it's supposed to work?
/Jesper
Has there been any resolve in this issue? I have a multi domain setup as well and see the same issue that Jesper described. Is there no way to force niceurl to use virtual/relative url's rather than select from the available alternate domains?
Sean
Hi,
For me it seems to depend on the domain you are connected with when editing content or publishing the site.
If i am right, in a multisite umbraco deployment, you should avoid republishing the entire site or you will get for all sites the same domain in the link to document.
In this case NiceUrl sometimes fails to return the good host.
Anyway it is strange to have an inconsistent response, as I saw the host in the links swapping randomly when navigating inside a site.
Any other idea ?
Thanks
Vincent
is working on a reply...