Copied to clipboard

Flag this post as spam?

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


  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Jun 27, 2011 @ 09:58
    Jesper Ordrup
    0

    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

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jun 27, 2011 @ 10:26
    Stefan Kip
    0

    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.

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Jun 27, 2011 @ 10:37
    Jesper Ordrup
    0

    I thought the same. But not here. There most be some way to control this.

    Btw Im using 4.7.

    Best

    Jesper

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Jun 27, 2011 @ 10:39
    Jesper Ordrup
    0

    No - Republish entire site doesnt help :-)

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jun 27, 2011 @ 10:50
    Stefan Kip
    0

    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:

    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...

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Jun 27, 2011 @ 11:11
    Jesper Ordrup
    0

    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

  • Sean Sachen 31 posts 77 karma points
    Sep 02, 2011 @ 18:13
    Sean Sachen
    0

    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

  • Vincent QUILLET 5 posts 25 karma points
    Jan 14, 2012 @ 23:47
    Vincent QUILLET
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft