Static Mappings

You can create static mappings from existing legacy URLs to new URLs in Salesforce B2C Commerce. The URLs can be either dynamic pipeline calls or static resources, however, the source URLs must be unknown to the system. Static mappings must be replicated from Staging to Production instances. The file size of the configuration in Business Manager is limited to 2MB. If you exceed the limit, use the site import and export functionality to update the static mappings.

Note: Static Mappings require the configuration of a hostname alias in site > Merchant Tools > SEO > Aliases module first. Use the domain name.
Each line contains one mapping definition where both parts are separated by a whitespace. You can add a comment line by using an ASCII '#' or '!' as the first non-white space character in the line. You can map URLs that contain whitespace by surrounding the whitespace with single quotes.

Mappings with wildcards are only valid if they are prepend OR append the URL, but can’t do both. For example, **/a-sample-url** is an invalid mapping.

Dynamic pipeline calls follow this syntax:

<legacy URL> [i] p,[<protocol>],[<host>],<pipeline>[,<locale>][,<parameter name>,<parameter value>]*

Static resources follow this syntax:

<legacy URL> [i] s,[<protocol>],[<host>],[<unit>],[<locale>],<path>
Parameter Considerations
Legacy URL Can be either a relative URL (only path without host name) or an absolute URL (host name and path specified). Supports '**' as prefix or postfix wildcards and the query string ignore wildcard '?**'.
Optional 'i' parameter Indicates a case insensitive match.
<protocol> and <host> If unspecified, the respective values of the request are used.
<pipeline> Indicates the dynamic pipeline.
<unit> Folders are named in the catalog/library/organization structure. The <unit> URL parameter refers to one of these folders in the file system.
  • A catalog (for all category and product images)
  • A content library (for all images used on content assets)
  • The organization (for all other resources, for example promotion images)
<locale> If unspecified, the default locale is used.
<parameter name>,<parameter value> Used with a dynamic pipeline call. If <parameter name> or <parameter value> contains whitespaces, they must be enclosed in double quotes (" "). Don't use single quotes(' ').
<path> Used with a static resource.

Use the following variables in the path or as parameter value:

Variable Description
{_url} The entire original URL
{_path} The path portion of the original URL
{_host} The host names used
{_querystring} The query string of the original URL
{<name>} Parameter from the original URL

Example of mapping

Pattern Template
http://example.com/image/logo.gif
s,,,,,/content/images/test/logo.gif
Old URL New URL
http://example.com/image/logo.gif
http://example.com/on/demandware.status/WFS/​<site>/<unit>//content/images/test/logo.gif

Examples

Dynamic pipeline calls

This maps a legacy press page to a new press page.

http://www.yourhost.com./pressuk i p, https,,,en_GB,Link-Page,cid,PRESS

This maps a legacy catalog location to a new catalog location.

/jump/to/catalog p,,,Link-Category,,cgid,K,name,K

This maps the contents of a category from an old store with an absolute URL reference to a new catalog location.

http://www.oldstore.com/my/old/category/** p,,,Link-Category,,cgid,C,name,C

This maps the contents of a category from an old store with a relative URL reference to a new catalog location.

**/catalog/shoes?** p,,,Link-Category,,cgid,S,name,S

This maps a specific URL to a new catalog location.

/summerspecials p,,,Link-Category,,cgif,SummerSpecials

Static Resources

This maps one static page to another on the same web site:

/aboutus s,,,,,/html/about_us.html 

This maps a legacy image with an absolute URL to an image in a new location.

http://www.mystore.com/show/my/image s,,,,,/images/add_cart.gif

This maps a legacy image with a relative URL to an image in a new location.

**/product-big-image.gif s,,,,,/images/product_big_image.gif

The <Unit> Parameter

B2C Commerce static resources are owned by:

  • A catalog (for all category and product images)
  • A content library (for all images used on content assets)
  • The organization (for all other resources, for example promotion images)

In the file system of your B2C Commerce instance, you can see folders that are named like the catalog/library/organization. The <unit> URL parameter refers to one of those folders in the file system. You can also map to static resources contained in cartridges by using "-" as the unit name.

These are some examples of resource paths:

Catalog: Sites-apparel-catalog

/on/demandware.static/Sites-SiteGenesis-Site/Sitess-apparel-catalog/default/v1283800996326/images/large/10160_242.gif 

Content library: Sites-SiteGenesis-Library

/on/demandware.static/Sites-SiteGenesis-Site/Sites-SiteGenesis-Library/default/v1283800996326/images/homepage/homepage_bottom_left.gif

Organization: Sites

/on/demandware.static/Sites-Site/Sites/default/v1283800855701/images/standard_storeLocatorMens.gif

Mapping URLs with Whitespace

If you want to redirect a URL that contains white space, surround the product or brand name that contains white space with double quotes

Example 1: Redirecting a Product Name with White Space

Static mapping:"/Product Name" p,,,Product-Show,,pid,MyProductID

Incoming URL: www.mysite.com/Product Name

Redirects to: http://www.mysite.com/Sites-MySiteID-Site/default/Product-Show?pid=MyProductID

Example 2: Redirecting a Brand Name with White Space

Static mapping: "/mapping with whitespaces" p,,,Search-Show,,prefn1,brand,prefv1,"Brand Name"

Incoming URL: www.mysite.com/Brand Name

Redirects to: http://www.mysite.com/Sites-MySiteID-Site/default/Search-Show?prefn1=brand&prefv1=Hugo%20Boss

Troubleshooting

If you migrated from the SEO Support module to the URL Rules module, you might find static mappings overridden by redirects in the URL archive. For information on removing obsolete redirects from the archive, see Using the SEO URLs URL Archive Tab.