Copied to clipboard

Flag this post as spam?

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


  • firepol 125 posts 173 karma points
    Apr 10, 2014 @ 13:46
    firepol
    0

    Culture and Hosting not working properly on localhost/other server (same db)

    Hi,

    I have created an empty MVC project in visual studio, copied all the files but not the bin folder (got that via nuget, via umbraco core).

    So I develop my umbraco website locally. In the company I'm working for, however, I need to show to our consultants some results, we have an internal DEV server for that.

    DEV and local share the same database, same app_data folder, same media folder. Files are present locally in my visual studio project and on the DEV Server (I linked media and app_data pointing there).

    I have a multi-language website with this structure:

    -en (english)
    --about
    --contact
    --etc.

    -de (german)
    --info
    --kontakt
    --etc.

    Now if I do nothing, the about page will have as link about.aspx if I want to have /en/about.aspx I need to configure Culture and Hostnames: I add my local server domain as follows: http://localhost:53360/en and associate it with english.

    Now, when I go to my dev server, e.g. http://mydevserver.mycompany.com/en the website works. All links, if I enter them manually in the browser work, but the links in the navigation (I use rator views to build navigation menus) are all pointing to localhost.

    So I think, I add to "en" a new domain, like this: http://mydevserver.mycompany.com/en and associate it to English. I republish the website when logged in the devserver backend, still the links point to localhost.

    If I remove the localhost domain and I keep the devserver one, then thex work, but then I have the same problem locally, when using localhost I will click and the links will point to the devserver...

    Is this an umbraco bug? Should I file this as bug? Would be nice to have this working, in case I'm doing something wrong it would be nice to have a proper solution, thank you.

  • Dan Lister 416 posts 1974 karma points c-trib
    Apr 10, 2014 @ 16:48
    Dan Lister
    0

    What have you got the following App Setting set to in web.config? If its true, try setting it to false and republish your site.

    <add key="umbracoHideTopLevelNodeFromPath" value="true" />
  • firepol 125 posts 173 karma points
    Apr 11, 2014 @ 11:11
    firepol
    0

    Hi Dan, thanks for your answer. Actually my installation is a bit more complex than what I said.

    It's not only a multi-language site, but also a multi domain website.

    So actually the structure is like this:

    -mywebsite (en)
    --about
    --contact
    --etc.

    -mywebsite (de)
    --info
    --kontakt
    --etc.

    -other(en)
    --foo
    --bar
    --etc.

    -other(en)
    --füü
    --biergarten
    --etc.

    So if I do as you suggest, then the url will contain the ugly names I use in the backend to classify the website, like this: http://localhost:53360/mywebsite-(en)/info.aspx

    I think what's broken / buggy is that if I add more domains to the same node (localhost, or devserver), the links are still messed up...

  • Stephen 767 posts 2273 karma points c-trib
    Apr 22, 2014 @ 09:19
    Stephen
    0

    Just to clarify, you set:

    Content
    - Site 1 English (localhost/en, dev.com/en)
    - - About Us
    - Site 1 German (localhost/de, dev.com/de)
    - - Uber Uns

    Then you browse dev.com/en/about-us and create a menu. What you should see is:

    • All urls to english pages should be relative
    • All urls to german pages should be absolute, using localhost/de or dev.com/de

    Can you confirm this is what you see? Then I have a lengthy explaination of what's happening and what to do.

  • firepol 125 posts 173 karma points
    Apr 22, 2014 @ 16:46
    firepol
    0

    @Stephen,

    in the meantime I upgraded from umbraco 6.1.6 to 6.2.0-RC. In the menus I see relative paths in both cases.

    I also re-added for the Site 1 both the hostname pointing to http://localhost:53360/en and http://mydevserver/en and same for German. Now links work as expected. Seems the issue was fixed in umbraco 6.2-RC ? If so, well done, hopefully it stays so for 6.2 final release...

  • Stephen 767 posts 2273 karma points c-trib
    Apr 22, 2014 @ 16:51
    Stephen
    0

    Well I... am not sure what the issue was, really. So, happy if it works now.

  • firepol 125 posts 173 karma points
    Apr 23, 2014 @ 07:37
    firepol
    0

    I found the cause: I tested also on another multi-language website I recently did. Umbraco 6.1.3, same problem.

    I added the hostnames:

    English (en-US):

    German (de-CH):

    Localhost, no problem.

    devsrv, links pointed to localhost.

    Solution: login to the other website backend, in my case http://devsrv/umbraco/ then right click on "Content" > Republish entire site.

    I think I was doing that, but apparently I missed that or after adding new content I had to do it again...

    Also what helped, when browsing the umbraco website from the Visual Studio IIS Express (or Cassini): close IIS Express, or close the solution, open it again.

  • Stephen 767 posts 2273 karma points c-trib
    Apr 23, 2014 @ 08:42
    Stephen
    0

    I am not sure I fully understand the issue. A bit of background here: urls are calculated each time they are requested either by the front-end or the back-office, because they depend on the current url. So, at the moment you request the url, say - when you create the menu, we know (that's cached) that it is under the English node, and that the path from that node is /about-us/our-achievements.

    What we do from there depends on where you are at the moment. If you are already browsing a page under that same English node then a relative url is safe and we can return /en/about-us/our-achievements. If you are browsing a page under German then a relative url would not work. We have to add a host, so the url could be localhost:port/en/about-us/our-achievements.

    You can see an issue here: should it be localhost:port/en/... or devsrc/en/...? There is a way to decide but before I go into it I'd want to make sure I understand what you are doing.

    Republishing the entire site, from one backoffice or another, will only refreshed the cached data (this is page /about-us/our-achivements under the English node) and therefore should have no impact whatsoever on the final urls. You don't need to do this. But again, yes, depending on where you come from (ie whether you are on localhost:post/umbraco or devsrc/umbraco, you will not see the same urls. But that's normal.

    Am I making sense?

    Once we agree on that I can explain how to tell Umbraco which to pick when it has to choose between localhost:port and devsrv at the time of creating a url.

Please Sign in or register to post replies

Write your reply to:

Draft