To have Umbraco route incoming requests to the appropriate sites in the installation, you must set up hostnames for Umbraco to “listen” for. The examples throughout this chapter have the Runway site set up to be translated into two languages: English and Swedish.
To support multiple sites and entry points for your Umbraco installation, you must leave the default setting of umbracoHideTopLevelNodeFromPath as true. This tells Umbraco to exclude the Content node from the path, thus pointing to the first second-level node as the homepage. In the following examples, you will instruct Umbraco to map a configured hostname to the correct second-level node in the content tree.
Next you must set up your Umbraco installation to have at least two second-level (in the context of the content tree) nodes so that you can set up the necessary hostnames. Because this example is a multi-lingual setup, the steps show how to add another language, Swedish, to the installation as well as how to copy the Runway site that was installed in Chapter 1 and paste it under the Content node:
You now have an identical copy of the original Runway site in unpublished status, as shown in Figure 7-3.
To differentiate the two sites, you should rename the homepage nodes for each site to something more identifiable. For example, Runway Website (en) and Runway Website (se) would be viable candidates. What you name your sites is not relevant as you will see shortly when you apply the hostnames that you created in the preceding steps.
You rename a node simply by changing the Name value in the Properties tab.
You can now publish the Swedish website so that you have something to work with:
One last configuration change is necessary to ensure that multiple sites within your installation will work. Locate your umbracoSettings.config file. This file is located in <installation path>/config/umbracoSettings.config. Locate the <requestHandler /> settings section in this file and set the <useDomainPrefixes /> value to true, as shown in Listing 7-1. This ensures that all URLs are unique so page links do not cross from one website to another.
LISTING 7-1: Setting URLs to use domain prefixes
<requestHandler> <!-- this will ensure that urls are unique when running with multiple root nodes --> <useDomainPrefixes>true</useDomainPrefixes> … </requestHandler>
So far, you haven't made any real changes to the public site. If you tried to access your site at this point (in this example, by pointing your browser to http://umbracousersguide.com.local), you'll notice that the same site keeps popping up. That's because it's the default homepage node at the moment. You may also notice that the Link to document in the Properties tab for each of the homepage nodes links to the start of the corresponding content structure. In other words, the English version has runway-homepage-(en).aspx and the Swedish version has runway-homepage-(se).aspx.