SETTING UP MULTIPLE SITES

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:

  1. Navigate to the Settings section of your installation.
  2. Right-click the Languages node and click the Create menu item.
  3. Select Swedish (Sweden) from the drop-down list, and click the Create button.
  4. Navigate to the Content section in the Umbraco backoffice.
  5. Right-click the Runway Homepage node and click the Copy menu item, as shown in Figure 7-1.
  6. In the resulting dialog, select Content by clicking the Content node, as shown in Figure 7-2.

    FIGURE 7-1

    image

    FIGURE 7-2

    image

  7. Click the OK button to proceed.
  8. Click the Close this window link in the resulting confirmation dialog.

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.

FIGURE 7-3

image

image 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:

  1. Right-click the Runway Website (se) node and click Publish.
  2. Select Publish Runway Website (se) and all its subpages as well as Include unpublished child pages, as shown in Figure 7-4.
  3. Click the Publish button to finish.

FIGURE 7-4

image

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset