A hostname alias is a way of defining alternative names for an existing website URL. You must set up and register the DNS and domain names to use these extra hostnames in aliases.
Merchants create hostname aliases for the following reasons:
www.my-shop.com/us
, site
2, locale A is www.my-shop.com/uk
, and site 2, locale
B is www.my-shop.com/de
.www.myshop.com,
myshop.com,
or
www.myothershopdomain.com.
www.myshop.com
and
www.myshops.com.
www.myshop.de
triggers the de_DE
locale.
See the Localized mapping section below.shoes.myshop.com
goes to the Shoes category pageProduction Instance Hostname
The Production instance hostname is similar to your.instance.hostname.example.com
, with an IP address such as
100.100.100.1
. This hostname is used to access Business Manager and
to connect to UX Studio, WebDav, and other development connections. While you can use it
to view the storefront, customers must not use it to access the storefront because it
isn't best practice for SEO, doesn't promote brand marketing, and is not secure.
Accessing the Storefront Homepage with Your Hostname
www.mydomain.com
, to directly access the storefront
homepage and link to an SSL certificate, you must do the following:production.realm.web.demandware.net
and the IP
address is 100.100.100.1, the first certificate installed gets the IP
address 100.100.100.1. If a second certificate is installed it gets a
new IP address, such as 100.100.100.2. You must also ensure that your
DNS is updated with the IP of the corresponding hostnames.
URL syntax in this topic uses the following terms:
Element | Description |
---|---|
Entered URL | URL originally entered by the customer. |
Host Name | Part of the URL that indicates the host name. For
example: www.sitegenesis.com . |
Site Path | Optional slash-delimited URL segment that is appended to
the host name. The site path enables B2C Commerce to differentiate
between multiple sites using the same host name. For example,
the site path might be UK for a site used in
the United Kingdom
(http://www.sitegenesis.com/UK ) or
US for a site used in the United States
(http://www.sitegenesis.com/US ). A site path
can include multiple slashes and can be anything you want
(one/two/three/N ). |
Locale | Optional locale identifier that can be specified in mapping rules. A locale configured in a mapping rule will be used if the hostname (or the hostname plus the site-path) matches the beginning portion of the entered URL. For each entered URL, B2C Commerce determines the correct locale by examining the hostname alias files, looking for a corresponding mapping rule, and falling back to the default locale configured for the site if a corresponding mapping rule isn't found. |
Path | Part of the URL that indicates the path to the page. The
path is logically appended to the locale (if there is one), to
the site path (if there is one), or to the host name. For
example:
/womens/accessories/promopage.html . |
The hostname alias file defines what hostnames/domains are supported by B2C Commerce. It also defines what pipelines or controllers are triggered for a specific URL. This file enables a Production instance with multiple IP addresses to provide different storefront content for multiple domains per site or multiple sites per realm. This file is required for a Production instance launch.
For more specific information on mappings, see URL Redirects.
You can create a set of rules that controls how different URLs are processed by B2C Commerce. These rules use the JSON (Java Script Object Notation) format (see Json.Org).
The alias file should include the proper https-host. The https-host must reflect the host name.For example, www.mysite.com maps as:
{ "__version": "1", "settings": { "http-host": "www.mysite.com", "https-host": "www.mysite.com" } }
See Configuring a Hostname Alias.
You can also configure your hostname alias file to avoid multiple entry points and duplicate URLs, thus increasing the SEO value of your storefront site. See the Mapping Rule Syntax section below.
For additional information on how B2C Commerce constructs URLs, see URL Rules URL Syntax.
The following code shows the basic file format:
{"__version": "1",
"settings": {
"http-host": "httphostname",
"https-host": "httpshostname",
"job-hostnames":
{
"default":"www.my-default-host.com",
"de":"www.my-de-host.com",
"en":"www.my-en-host.com"
},
"site-path": "sitepath",
"default" : "defaultValue",
"site-path-trailing-slash" : "yes" }
"hostName1": [
{ mappingRule1 },
{ mappingRuleN }
],
"hostNameN": [
{ mappingRule1 },
{ mappingRuleN }
]
}
The parameters are as follows:
Parameter | Description |
---|---|
version | Required. Currently the value of this property must be 1. This value indicates the syntax version of the file. If this is changed to any other number, all entries are ignored. |
settings* |
Optional. When you set this property, you can specify the following:
|
hostName | Hostname in the entered URL. You can have multiple host names, enabling the site to handle requests for multiple host names. For each host name, you can include multiple mapping rules. |
settings
property works only when there is one primary domain
on a site, to which all other hostnames redirect. If the site supports multiple domains or
hostnames, it's best to leave settings undefined and comment this entire section out. You
should use this property if you want all of your sites to use the same host.your.instance.hostname.example.com
). The hostname address can also
include the realm or name of a partner who is implementing the site.{
"__version": "1",
"www.mybrand.com" : [{"pipeline": "Home-Show" }],
"mybrand.com": [{"host": "www.mybrand.com", "path":"/"}]
}
"www.mybrand.com" : [{"pipeline": "Home-Show" }],
"mybrand.com": [
{ "host": "www.mybrand.com", "path":"/" }]
The alias file can also
be used to direct users to a specific pipeline or landing page based on
the hostname entered in the URL. This enables a single site to host micro
sites for other domains, and is more typically used for calling
alternative cartridge pipelines or controllers for use in applications
such as mobile applications, with hostnames such as
m.mybrand.com.
{
"outlet.mybrand.com": [
{
"pipeline": "Search-Show",
"params": { "cgid": "category-subcategory-outlet" }
}
],
"m.mybrand.com": [
{
"pipeline": "mHome-Show"
}
],
"www.mybrand.com": [
{
"if-agent-contains": ["iphone", "ipod", "android"],
"host": "m.mybrand.com"
}
]
]
When using a filter such as
if-agent-contains,
the JSON format doesn't allow an ELSE
statement inside a code block; it only executes the one line host:,
so you need another block for www to handle regular browsers that do not
match mobile.
If the hostname alias file contains a JSON error, Business Manager notifies you of the error, but saves your changes to the file. At run time, however, the file isn't used if an error exists inside it. You should Debug the File using a separate tool to ensure that it's valid before you save it in Business Manager.
It is
not possible to set up a URL redirect or mappings for the following paths
because the keywords dw
, _dw
, and
s
are reserved by B2C Commerce.
http://hostname/dw
http://hostname/_dw
http://hostname/s
Each mapping rule is defined by a set of attributes and looks like the following:
{
"www.my-host.com":[{"pipeline":"Home-Show", "apply-to-host-only-request-with-params":"true"}]
"name": "mobile",
"if-agent-contains": ["iphone","ipod"],
"if-site-path": "DE",
"host": "m.shop.com",
"path": "index.html"
"pipeline": "Summer-Start",
"locale": "de",
"params": {...},
}
The parameters are as follows:
Parameter | Description |
---|---|
apply-to-host-only-request-with-params |
Optional. Using this parameter, you can control B2C Commerce behavior using the configuration in your aliases file, shown as follows, and perform hostname redirects for these requests directly: When
perform hostname redirects for these requests directly, B2C Commerce
retains the request parameter and inserts the configured
parameter in the hostname destination URL. When the request
parameter and the configured parameter identifier are equal, the
request parameter is preferred. See the examples below.
See Dynamic Mappings. |
description |
Optional. Describe the parameter. For example, using |
entry-point-destination | Optional. Use with entry-point-pipelines to automatically redirect requests to avoid duplicate home page URLs. |
entry-point-pipelines | Optional. Use with entry-point-destination to automatically redirect requests to avoid duplicate home page URLs. Entry point pipelines can point to controllers and pipelines. |
host |
Optional. The name of the host to which the request is redirected. Note: When configuring a hostname redirect, you
typically use a rule like this:
{"host":"my.host.com",
"path":"uk"} or {"host":"my.host.com",
"pipeline":"Home-Show"} . When you have a path and
pipeline, the redirect is unclear because requests with
old-hostname + path are redirected to this new-hostname + path,
which is used for host-only requests. So, when you have these
two parameters, the pipeline is preferred. |
if-agent-contains | Optional. An IF condition to indicate
that the following rule is only executed if the attribute
condition is met. The attribute condition is an optional list of
strings. If the attribute isn't provided, the rule is always
selected. This is intended to allow redirects to different URLs
for different devices. |
if-site-path |
Optional. When this property is set, B2C Commerce checks
its value against the site path in the entered URL, looking for
a match. If it finds a match, B2C Commerce uses the mapping rule.
However, in this case, B2C Commerce recognizes only the
This property is also checked when B2C Commerce
generates storefront URLs. For URL generation, B2C Commerce uses the
first mapping rule that matches the current hostname and locale.
If the matching mapping rule specifies a value for the
Note: The
if-site-path and site-path
parameters are only valid in the corresponding section, where
is a setting and if-site-path is a hostname
rule. B2C Commerce generates and consumes URLs based on the configured
if-site-path or site-path . When
using if-site-path statement in a hostname rule, site-path and
http(s)-host in the settings sections must be empty or defined for a
different hostname.” |
locale | Optional. The locale to use when mapping to a pipeline or to a site path. |
Name | Optional. The name for the rule. |
params | Optional. Parameters to add to the pipeline. |
path | Optional. The path that the customer is redirected to via
a permanent 301 redirect. To redirect the customer, B2C Commerce
constructs a URL by appending the value of the
path property to the value of the
host property. However, if the
host property isn't configured, B2C Commerce ignores
the path property. Also, B2C Commerce adds the value
of the path property to the value of the
host property only if the entered URL is a
hostname-only request; otherwise, B2C Commerce adds the path
extracted from the request URL to the value of the
host property. |
pipeline | Optional. A pipeline triggered by the
hostName which is used if no
host is provided. Pipeline rules are only used
if no host is supplied. You can use the
locale and params syntax to
specify a locale and parameters for the file. |
site-path-trailing-slash | Optional. A trailing slash is added (or not) to the redirected site path. See the example below. |
Example 1: Controlling the Site Path Trailing Slash
You can control the site
path trailing slash for each site path with the
site-path-trailing-slash
setting.
Start by configuring the preferred HTTP/HTTPS site hostname, as follows:
"settings" : { "http-host" : "www.your-http-hostname.com", "https-host" : "www.your-https-hostname.com",
"site-path": "en",
"site-path-trailing-slash" : "yes" }
Then define the hostname rules, as follows:
"www.your-hostname.com" : [
{ "locale" : "default" },
{ "if-site-path": "en", "site-path-trailing-slash" : "yes", "locale" : "en" },
{ "if-site-path": "de", "site-path-trailing-slash" : "no", "locale" : "de" } ]
Requests are automatically redirected as shown here:
from | to |
---|---|
www.your-http-hostname.com/en redirects | www.your-http-hostname.com/en/ |
www.your-https-hostname.com/en redirects | www.your-https-hostname.com/en/ |
www.your-hostname.com/en redirects | www.your-hostname.com/en/ |
www.your-hostname.com/de/ | www.your-hostname.com/de |
Example 2: using the
apply-to-host-only-request-with-params
setting
This attribute enables you to forward hostname requests with parameters to the configured pipeline, for example:
"www.my-host.com":[{"pipeline":"Home-Show",
"apply-to-host-only-request-with-params":"true"}]
This example
forwards the requests www.my-host.com/
and
www.my-host.com/?param=aValue
to the
Home-Show
pipeline and preserves the original URL
parameters.
Performing hostname redirects Directly
Using this parameter, you can perform hostname redirects for these requests directly. B2C Commerce retains the request parameter and inserts the configured parameter in the hostname destination URL. When the request parameter and the configured parameter identifier are equal, the request parameter is preferred.
This is the configuration in the alias file:
"www.your-hostname.com" :
[ { "host": "www.your-other-hostname.com", "path": "/", "params" : {"cfgParam":"aOtherValue"}} },
{ "apply-to-host-only-request-with-params": "true" }]
With this configuration, the following request:
www.your-hostname.com/?reqParam=aValue
Is redirected to the following:
www.your-other-hostname.com/?reqParam=aValue&cfgParam=aOtherValue
Example 3: integrate default HTTP and HTTPS host Names
The following example configures the main HTTP and HTTPS hostnames for the production instance. The settings section is optional.
"settings": {
"http-host": "www.sitegenesis.com",
"https-host": "secure.sitegenesis.com"
}
],
Example 4: Redirect from Alternate URL to Preferred Domain
The following example is a rule
that redirects the alternate URL sitegenesis.com
to the preferred domain. If
a customer enters sitegenesis.com as their URL
(http://sitegenesis.com/*
), where *
is any path, they are redirected via a 301 redirect to http://www.sitegenesis.com
/*.
"sitegenesis.com": [
{
"host": "www.sitegenesis.com",
}
],
Example 5: Redirect from Misspelled URL to Preferred Domain
This example shows redirect from
the misspelled URL sitegensis.com
to www.sitegenesis.com
. If a
customer enters sitegensis.com as their URL
(http://sitegensis.com/*
) they are
redirected via a 301 redirect to www.sitegenesis.com
.
"sitegensis.com": [
{
"host": "www.sitegenesis.com",
}
],
Example 6: Use Preferred Locale with Localized Host Name
This example shows how to associate locale
with a localized URL www.sitegenesis
.
.
de
"www.sitegenesis.de": [
{
"locale": "de_DE",
}
],
Example 7: Redirect from Landing Page Link to Category
This example shows a hostname-only
URL http://electronics.sitegenesis.com/
that
results in a call to the Search-Show pipeline with a category ID parameter
of electronics. This can be used in marketing emails to direct a customer
to a specific category or page.
"electronics.sitegenesis.com": [
{
"pipeline": "Search-Show",
"params" : {"cgid"="electronics"}
}
],
Example 8: redirect based on client device
Host redirect is based on the user agent header. With each rule, it's possible to associate precondition based on content of "user-agent" http header. In the example below an HTTP requests with "User-Agent" header containing "iPhone" or "iPod" will be redirected (301) to apple.sitegenesis.com and those with "blackberry" to bb.sitegenesis.com.
"www.sitegenesis.com": [
{
"if-agent-contains": ["iphone","ipod"],
"host": "apple.sitegenesis.com",
},
{
"if-agent-contains": ["blackberry"],
"host": "bb.sitegenesis.com",
}
],
Example 9: Three Sites Sharing Single Host Name
In this example, three existing sites previously used different host names. Because each of these
sites supports a single locale, you don't have to specify the locale in your mapping rules.
Your goal is to have all three sites share the host name (www.my-site.com
)
but use different site paths to differentiate themselves:
www.my-site.uk
and you
want to change it to www.my-site.com/UK
.www.my-site.com
and you
want to change it to www.my-site.com/US
.www.my-site.de
and you
want to change it to www.my-site.com/DE
.You also want B2C Commerce to redirect URLs containing old hostnames to the new hostname plus site path values.
To accomplish these goals, you configure the hostname alias file for site 1 as follows:
"settings" :
{
"http-host" : "www.my-site.com",
"https-host" : "www.my-site.com",
"site-path" : "UK",
"default" : "false"
}
"www.my-site.uk":
[
{
"host" : "www.my-site.com", "path" : "UK"
}
]
Next, you configure the hostname alias file for site 2 as follows:
"settings" :
{
"http-host" : "www.my-site.com",
"https-host" : "www.my-site.com",
"site-path" : "US",
"default" : "true"
}
Finally, you configure the hostname alias file for site 3 as follows:
"settings" :
{
"http-host" : "www.my-site.com",
"https-host" : "www.my-site.com",
"site-path" : "DE",
"default" : "false"
}
"www.my-site.de":
[
{
"host" : "www.my-site.com", "path" : "DE"
}
]
Example 10: a Single Site Supporting Multiple Host Names and Locales
When you want to redirect
from domain A to domain B with the same site-path
mapping
for both domains, you must configure if-site-path
conditions for both domains.
In this example, you have a single site that supported multiple host names in the past, each of which supported a single locale. As in the previous example, you want B2C Commerce to redirect the old hostnames to the new hostname plus site path values:
www.my-site.uk
(whose
locale is en_UK
) should now redirect to
www.my-site.com/UK
.www.my-site.com
(whose
locale is en_US
, the default locale) should now
redirect to www.my-site.com/US
.www.my-site.de
(whose
locale is de_DE
) should now redirect to
www.my-site.com/DE
.To accomplish these goals, you configure the hostname alias file for the site as follows:
"settings" :
{
"http-host" : "",
"https-host" : "",
"site-path" : "",
"default" : ""
},
"www.my-site.com":
[
{
"locale" : "en_US",
},
{
"locale" : "de_DE",
"if-site-path" : "DE"
},
{
"locale" : "en_US",
"if-site-path" : "US"
},
{
"locale" : "en_UK",
"if-site-path" : "UK"
},
],
"www.my-site.de":
[
{
"host" : "www.my-site.com", "path" : "DE"
}
],
"www.my-site.uk":
[
{
"host" : "www.my-site.com", "path" : "UK"
}
]
Example 11: Two Sites with Multiple Hosts and Locales
In this example, you want two sites (site 1 and site 2) to work with the multiple host names and
locales. Both sites acknowledge the host names www.my-site.eu
and
www.my-site.com
.
For the first host name
(www.my-site.eu
), you want to specify the
following:
www.my-site.eu
should work by
itself without a site path. B2C Commerce should direct the URL to site 1,
and the default locale should be en
.www.my-site.eu/DE
should direct
the URL to site 1, and the locale should be de
.www.my-site.eu/FR
should direct
the URL to site 1, and the locale should be fr
.www.my-site.eu/US
should direct
the URL to site 2, and the locale should be en
.For the second host name (www.my-site.com), you want to specify the following:
www.my-site.com
should work by
itself without a site path. B2C Commerce should direct the URL to site 2,
and the default locale should be en
.www.my-site.com/FR
should direct
the URL to site 2, and the locale should be fr
.www.my-site.com/UK
should direct
the URL to site 1, and the locale should be en
.www.my-site.com/DE
should direct
the URL to site 1, and the locale should be de
.In addition the above goals, you want to add the EXAMPLE
site path to both the www.my-site.eu
and the
www.my-site.com
host names. For this site path, the
locale should be en
, and the configuration should direct
the URL to the Example-DoSomething
pipeline, which will
take the following parameters:
cgid
― This parameter is set to the value
"exampleCategory."color
― This parameter is set to the value
"blue."To accomplish these goals, you configure the hostname alias file for site 1 as follows:
"settings" :
{
"http-host" : "",
"https-host" : "",
"site-path" : "",
"default" : ""
},
"www.my-site.eu":
[
{
"locale" : "en",
},
{
"locale" : "de",
"if-site-path" : "DE"
},
{
"locale" : "fr",
"if-site-path" : "FR"
},
{
"locale" : "en",
"if-site-path" : "EXAMPLE",
"pipeline" : "Example-DoSomething",
"params" : {"cgid":"exampleCategory", "color":"blue" }
}
],
"www.my-site.com":
[
{
"locale" : "de",
"if-site-path" : "DE"
},
{
"locale" : "en",
"if-site-path" : "UK"
}
]
Next, you configure the hostname alias file for site 2 as follows:
"settings" :
{
"http-host" : "",
"https-host" : "",
"site-path" : "",
"default" : ""
},
"www.my-site.eu":
[
{
"locale" : "en",
"if-site-path" : "US"
}
],
"www.my-site.com":
[
{
"locale" : "en",
},
{
"locale" : "fr",
"if-site-path" : "FR"
},
{
"locale" : "en",
"if-site-path" : "EXAMPLE",
"pipeline" : "Example-DoSomething",
"params" : {"cgid":"exampleCategory", "color":"blue" }
}
]
The following table shows how these configurations cause B2C Commerce to handle different entered URLs:
Entered URL | Site | Locale | Pipeline | Parameters |
---|---|---|---|---|
www.my-site.eu | 1 | en | Default-Start | |
www.my-site.eu/DE | 1 | de | Default-Start | |
www.my-site.eu/FR | 1 | fr | Default-Start | |
www.my-site.eu/US | 2 | en | Default-Start | |
www.my-site.eu/EXAMPLE | 1 | en | Example-DoSomething | cgid=exampleCategory&color=blue |
www.my-site.com | 2 | en | Default-Start | |
www.my-site.com/UK | 1 | en | Default-Start | |
www.my-site.com/FR | 2 | fr | Default-Start | |
www.my-site.com/EXAMPLE | 2 | en | Example-DoSomething | cgid=exampleCategory&color=blue |
Example 12: Preferred Hostnames for URL Generation Without Request Context
To avoid custom code, the alias file now supports a mapping to define hostnames within the job context. The mapping can be locale-specific, and follow a language fallback from country to language to default locale.
"settings" :
{
"job-hostnames" :
{
"default":"www.my-default-host.com",
"de":"www.my-de-host.com",
"en":"www.my-en-host.com"
}
},
"www.my-default-host.com":[{}],
"www.my-de-host.com":[{}],
"www.my-en-host.com":[{}],
The returned hostname for locales (following the language fallback) are as follow:
To make debugging easier, you should choose to use an external JSON debugger, such as the one available at http://www.jsonlint.com/. There are many other tools like this available to test the file.
Don't try to debug the hostname alias file in Business Manager through trial and error. If the file contains any JSON errors, the file is ignored and therefore any configured hostnames fail on the instance. Make sure that the file is valid JSON before saving it in Business Manager.
Alias configurations can be complex on a Production instance and should be tested before they are added - and not just for syntax. If you don't want to configure and register the DNS and domain names for your test environment, you can configure domain names on your local machine. This is also an option if no domain names are available for your test environment. To test your configuration:
nslookup
your.instance.hostname.example.com
into a console./etc/hosts: 123.45.678.91
my-test-hostname.com
.B2C Commerce performs two different types of host name alias processing: handling entered URLs, and generating storefront URLs. To handle an entered URL, B2C Commerce examines the entered URL, and dispatches the request to the appropriate site for further processing. During storefront URL generation, B2C Commerce constructs URLs that are visible to customers.
Handling entered URLs
When B2C Commerce receives an entered URL from the customer, B2C Commerce checks all hostname alias files for all sites in your organization, looking for a suitable mapping.
settings
property?settings
property) to handle the URL, and then continue to step 5.settings
property, is there a
match for both the hostName and the sitePath (specified in the
if-site-path
property)?settings
property, is there a match
for hostName?true
, and if it is, use the corresponding site to
handle the URL, and continue to step 5. If no site with a match
for hostName sets the defaultValue to true
, use
the first site in the sites list to handle the URL, and continue
to step 5.settings
property, is there a
match for just the hostName?settings
property? Default-Start
pipeline and return the response to
the customer. Otherwise, retrieve the requested resource
(executing a pipeline if necessary) and return the requested
resource to the customer. If no locale is specified, use the
default locale for the site when retrieving the requested
resource. Skip all of the remaining steps in this process.if-site-path
property?name
, locale
, pipeline
, and
params
properties. Ignore all other property values (for example,
ignore the if-agent-contains
property). Use the
name
, locale
, pipeline
, and
params
property values to determine how to handle the request. If
the entered URL specifies only the hostName and sitePath, check to see if the
pipeline
and params
properties are set; if so,
execute the configured pipeline
using the configured
params
(if any); if the pipeline
and
param
properties are not set, execute the
Default-Start
pipeline, and return the response to the customer. If
no locale is specified, use the default locale for the site when retrieving the
requested resource. Skip all of the remaining steps in this process.if-agent-contains
rule?if-agent-contains
must be included as the first
mapping in a rule or it's never reached.if-agent-contains
condition true?if-agent-contains
rule.if-agent-contains
rule.Yes - the entered URL is a host-only URL that looks like
this: http://www.sitegenesis.com/
.
pipeline
property
value, forward the request to the pipeline using the
pipeline,
locale,
and
params
properties.host
property
value, redirect to the specified host.path
, construct a
redirect URL by appending the value from the provided
path
parameter to the value of the
host
property. If no value is configured for
the host
property, ignore the
path
property.Default-Start
pipeline.No - the entered URL contains at least a partial path and
looks like this:
http://www.sitegenesis.com/electronics
host
property
value, replace the URL host with the host
value and use the rest of the path in the entered URL to
construct a 301 redirect.path
but no
host
property value, the
path
value is ignored.In order for the above process to work
correctly, if you specify the same host name in the
settings
property of multiple sites, set the
default
property to true
for only one
site.
Generating Storefront URLs
When generating storefront URLs, B2C Commerce adds the appropriate
site path to the generated URL. B2C Commerce determines the site path in the
following way for a given hostname and locale. If the
settings
property specifies a value for the
site-path
property, B2C Commerce uses the specified value as
the site path for the default locale (the configured default locale for
the site). If the settings
property doesn't specify a
value for the site-path
property, B2C Commerce uses the value
of the locale
property (or the locale
property plus the if-site-path
property) to determine the
site path, as follows:
if-site-path
property but doesn't specify a locale
property, the
value of the if-site-path property is used as the site path for the
default locale.if-site-path
rule with the specified locale
determines the site
path. (An empty site path is possible with a locale-only rule, if it
is the first rule for this locale.)