Avoid Duplicate Home Page URLs
Duplicate content is content that appears on a site for two (or more) URLs without a redirect. Even though the way search engines determine the search rating of a page changes frequently, most search engines decrease the search rating for such content. To have the best search ratings for your page, avoid duplicate content.
Salesforce B2C Commerce automatically handles most out-dated (duplicate) URL mappings without a configuration change. For mappings in the aliases file (host only rules and site paths), however, you can add mappings to enable automatic redirects. B2C Commerce will also use these duplicate resource rules to create your URLs as defined, using the B2C Commerce Script API.
Configuring Rules to Avoid Duplicates
You can configure rules in the Business Manager aliases module to define pipelines that have duplicate URL entry points or are contextual equals for a hostname. You can also define the preferred destination. B2C Commerce generates URLs using the first applicable mapping.
Duplicate URL Rule
The following example
shows how you can mark a pipeline (PiplineA-StartNode
) to
be checked for duplicate URLs (defined within the aliases file as
host-only
or site-path
rule). A redirect
automatically occurs if the URL isn't as defined by the preferred
destination configuration.
There are three destination types,
host
, site-path
, and
pipeline
, with host
and
site-path
requiring a corresponding rule.
From left to right, the first applicable rule is used to redirect duplicate URLs and to generate URLs:
"www.your-hostname.com" :
[
{
"pipeline" : "PiplineA-StartNode"
},
{
"if-site-path" : "eu",
"pipeline" : "PiplineA-StartNode"
},
{
"entry-point-pipelines" : [ "PiplineA-StartNode" ],
"entry-point-destination" : [ "host", "site-path", "pipeline" ]
}
]
With this configuration, all requests that identify the PiplineA-StartNode
pipeline are redirected to the host only destination. The host only URL invokes the
pipeline.
Duplicate Pipeline Rule
The following
example shows how you can mark pipelines (for example,
PiplineB-StartNode
and
PiplineC-StartNode
) as duplicates of, for example,
PiplineA-StartNode
. If either of the two marked pipelines
are called, a redirect automatically occurs to the defined
PiplineA-StartNode
URL:
"www.your-hostname.com" :
[
{
"pipeline" : "PiplineA-StartNode"
},
{
"if-site-path" : "eu",
"pipeline" : "PiplineA-StartNode"
},
{
"entry-point-pipelines" : [ "PiplineA-StartNode", "PiplineB-StartNode", "PiplineC-StartNode" ],
"entry-point-destination" : [ "site-path", "host", "pipeline" ]
}
]
With this configuration, all requests that identify the
PiplineA-StartNode
pipeline are redirected to the site
path destination. All requests that identify
PiplineB-StartNode
or PiplineC-StartNode
pipeline are redirected to the URL defined for
PiplineA-StartNode
, which is the site path
destination URL.
Checklist to Avoid Duplicate Resources
To avoid duplicate resources for your storefront URLs, you should do the following:
- Configure trailing slashes for:
- Categories
- Folders
- Pipelines
- If configured, site-paths
- Configure pipelines for host and site-path rules. (If no pipeline
is defined means, the
Default-Start
pipeline is invoked.)- Define a duplicate URL rule for those pipelines.
- If you have already defined RedirectURL mappings, remove them to avoid conflicts.
- Identify which pipelines are contextual equals. The most common
example is
Default-Start
, which forwards toHome-Show
. Define a duplicate pipeline rule to handle this. - Verify that rules are defined for all hostname mappings.
Examples
The following are examples:
Example 1: One Locale and One Hostname
In
this example, your site has one locale and one hostname defined. You have
identified Default-Start
(alias=homepage) and
Home-Show
(alias=home) as duplicate pipelines and
Default-Start
with multiple URLs. Your goal is to avoid
these duplicates and redirect them to the host only URL.
To do this, configure your hostname alias file as follows:
"www.your-hostname.com" :
[
{
},
{
"entry-point-pipelines" : [ "Default-Start", "Home-Show" ],
"entry-point-destination" : [ "host" ]
}
]
This is the new behavior for the following duplicate resource URL requests:
- www.your-hostname.com/ (invoking pipeline)
- www.your-hostname.com/home (redirect)
- www.your-hostname.com/home/ (redirect)
- www.your-hostname.com/homepage (redirect)
- www.your-hostname.com/homepage/ (redirect)
This is the new behavior for the URL generation API:
- pipeline
Default-Start
and host'www.your-hostname.com': www.your-hostname.com/
- pipeline
Home-Show
and host'www.your-hostname.com': www.your-hostname.com/
Example 2: Two Locales and Two Hostnames
In this example, your site has two locales
(en_UK
and de_DE
) and two hostnames that
are shared with other sites:
-
www.your-hostnameA.com
- works without a site path for this site -
www.your-hostnameB.com
- works with a site path only
You have identified Default-Start
(alias=homepage) and Home-Show
(alias=home) as duplicate
pipelines and Default-Start
with multiple URLs. Your goal
is to avoid these duplicates and redirect them to the host only URL, with
the site path URL as a fallback.
To do this, configure your hostname alias file as follows:
"www.your-hostnameA.com" :
[
{
"locale":"en_UK" },
{
"if-site-path":"de",
"site-path-trailing-slash" : "no",
"locale":"de_DE"
},
{
"entry-point-pipelines" : [ "Default-Start", "Home-Show" ],
"entry-point-destination" : [ "host", "site-path" ]
}
]
"www.your-hostnameB.com" :
[
{
"if-site-path":"uk",
"site-path-trailing-slash" : "no",
"locale":"en_UK"
},
{
"if-site-path":"de",
"site-path-trailing-slash" : "no",
"locale":"de_DE"
},
{
"entry-point-pipelines" : [ "Default-Start", "Home-Show" ],
"entry-point-destination" : [ "host", "site-path"
]
}
]
The new behavior for the following duplicate resource URL requests is as follows:
- www.your-hostnameA.com/ (invoking pipeline)
- www.your-hostnameA.com/home (redirect)
- www.your-hostnameA.com/home/ (redirect)
- www.your-hostnameA.com/homepage (redirect)
- www.your-hostnameA.com/homepage/ (redirect)
- www.your-hostnameA.com/de (invoking pipeline)
- www.your-hostnameA.com/de/ (redirect)
- www.your-hostnameA.com/de/home (redirect)
- www.your-hostnameA.com/de/home/ (redirect)
- www.your-hostnameA.com/de/homepage (redirect)
- www.your-hostnameA.com/de/homepage/ (redirect)
- www.your-hostnameB.com/uk (invoking pipeline)
- www.your-hostnameB.com/uk/ (redirect)
- www.your-hostnameB.com/uk/home (redirect)
- www.your-hostnameB.com/uk/home/ (redirect)
- www.your-hostnameB.com/uk/homepage (redirect)
- www.your-hostnameB.com/uk/homepage/(redirect)
- www.your-hostnameB.com/de (invoking pipeline)
- www.your-hostnameB.com/de/ (redirect)
- www.your-hostnameB.com/de/home (redirect)
- www.your-hostnameB.com/de/home/ (redirect)
- www.your-hostnameB.com/de/homepage (redirect)
- www.your-hostnameB.com/de/homepage/ (redirect)
The new behavior for URL generation API is as follows:
- host 'www.your-hostnameA.com'
- pipeline ('Default-Start' or 'Home-Show') and locale 'en_UK': www.your-hostnameA.com/
- pipeline ('Default-Start' or 'Home-Show') and locale 'de_DE': www.your-hostnameA.com/de
- host 'www.your-hostnameB.com'
- pipeline ('Default-Start' or 'Home-Show') and locale 'en_UK': www.your-hostnameB.com/uk
- pipeline ('Default-Start' or 'Home-Show') and locale 'de_DE': www.your-hostnameB.com/de
Example 3: Three Locales and One Hostname
In this example, your site has three locales
(en_UK
(site's default locale), fr_FR
,
and de_DE
), and one hostname. You want to support the
site-path both with and without the eu
prefix. You have
identified Home-Show
(alias=home) with multiple URLs and
the PipelineB-Show
pipeline (alias=show-something-b) as
duplicate for the PipelineA-Show
pipeline
(alias=show-something-a). Your goal is to avoid duplicate URLs for
Home-Show
and redirect requests for
PipelineB-Show
to
PipelineA-Show
.
To do this, configure your hostname alias file as follows:
"www.your-hostnameA.com" :
[
{
"if-site-path":"eu/uk",
"site-path-trailing-slash" : "no",
"pipeline":"Home-Show"
},
{
"pipeline":"Home-Show"
},
{
"if-site-path":"eu/fr",
"site-path-trailing-slash" : "no",
"locale":"fr_FR",
"pipeline":"Home-Show"
},
{
"if-site-path":"fr",
"site-path-trailing-slash" : "no",
"locale":"fr_FR", "pipeline":"Home-Show"
},
{
"if-site-path":"eu/de",
"site-path-trailing-slash" : "no",
"locale":"de_DE",
"pipeline":"Home-Show"
},
{
"if-site-path":"de",
"site-path-trailing-slash" : "no",
"locale":"de_DE",
"pipeline":"Home-Show"
},
{
"entry-point-pipelines" : [ "Home-Show" ],
"entry-point-destination" : [ "site-path" ]
},
{
"entry-point-pipelines" : [ "PipelineA-Show", "PipelineB-Show"],
"entry-point-destination" : [ "pipeline"]
}
]
Set the trailing slash to NO
for pipelines
and then enable it.
The new behavior for the following duplicate resource URL requests is as follows:
- www.your-hostname.com/eu/uk (invoking pipeline)
- www.your-hostname.com/ (redirect)
- www.your-hostname.com/home (redirect)
- www.your-hostname.com/home/ (redirect)
- www.your-hostname.com/eu/uk/ (redirect)
- www.your-hostname.com/eu/uk/home (redirect)
- www.your-hostname.com/eu/uk/home/ (redirect)
- www.your-hostname.com/eu/fr (invoking pipeline)
- www.your-hostname.com/fr (redirect)
- www.your-hostname.com/fr/ (redirect)
- www.your-hostname.com/fr/home (redirect)
- www.your-hostname.com/fr/home/ (redirect)
- www.your-hostname.com/eu/fr/ (redirect)
- www.your-hostname.com/eu/fr/home (redirect)
- www.your-hostname.com/eu/fr/home/ (redirect)
- www.your-hostname.com/eu/de (invoking pipeline)
- www.your-hostname.com/de (redirect)
- www.your-hostname.com/de/ (redirect)
- www.your-hostname.com/de/home (redirect)
- www.your-hostname.com/de/home/ (redirect)
- www.your-hostname.com/eu/de/ (redirect)
- www.your-hostname.com/eu/de/home (redirect)
- www.your-hostname.com/eu/de/home/ (redirect)
- www.your-hostname.com/eu/show-something-a (invoking pipeline)
- www.your-hostname.com/show-something-a (redirect)
- www.your-hostname.com/show-something-a/ (redirect)
- www.your-hostname.com/show-something-b (redirect)
- www.your-hostname.com/show-something-b/ (redirect)
- www.your-hostname.com/eu/show-something-a/ (redirect)
- www.your-hostname.com/eu/show-something-b (redirect)
- www.your-hostname.com/eu/show-something-b/ (redirect)
- www.your-hostname.com/eu/de/show-something-a (invoking
pipeline)
- www.your-hostname.com/de/show-something-a (redirect)
- www.your-hostname.com/de/show-something-a/ (redirect)
- www.your-hostname.com/de/show-something-b (redirect)
- www.your-hostname.com/de/show-something-b/ (redirect)
- www.your-hostname.com/eu/de/show-something-a/ (redirect)
- www.your-hostname.com/eu/de/show-something-b (redirect)
- www.your-hostname.com/eu/de/show-something-b/ (redirect)
- www.your-hostname.com/eu/fr/show-something-a (invoking
pipeline)
- www.your-hostname.com/fr/show-something-a (redirect)
- www.your-hostname.com/fr/show-something-a/ (redirect)
- www.your-hostname.com/fr/show-something-b (redirect)
- www.your-hostname.com/fr/show-something-b/ (redirect)
- www.your-hostname.com/eu/fr/show-something-a/ (redirect)
- www.your-hostname.com/eu/fr/show-something-b (redirect)
- www.your-hostname.com/eu/fr/show-something-b/ (redirect)
The new behavior for the URL generation API is as follows:
- pipeline 'Home-Show' and locale 'en_UK': www.your-hostname.com/eu/uk
- pipeline 'Home-Show' and locale 'fr_FR': www.your-hostname.com/eu/fr
- pipeline 'Home-Show' and locale 'de_DE': www.your-hostname.com/eu/de
- pipeline ('PipelineA-Show' or 'PipelineB-Show') and locale 'en_UK': www.your-hostname.com/eu/show-something-a
- pipeline ('PipelineA-Show' or 'PipelineB-Show') and locale 'fr_FR': www.your-hostname.com/eu/fr/show-something-a
- pipeline ('PipelineA-Show' or 'PipelineB-Show') and locale 'de_DE': www.your-hostname.com/eu/de/show-something-a
With this mapping, all pipeline aliases (or category/folder
mappings) are available with two site paths eu
and
eu/[locale]
. If these URLs are not published, for
example, via your sitemap or email recommendation, you don't need to
configure rules for these resources.