Migrating to a new ecommerce platform such as Salesforce is complicated and risky, so it is vital to get as much right as possible the first time through careful planning and execution. This is why we find it interesting to work with on new projects.

The following is a HTTPS migration gone wrong, which illustrates the dangers of a botched migration:

A graph showing what happens when a HTTPS migration goes wrong.
HTTPS migration for homebase.co.uk

There are lots of things that could go wrong in migrations, below are examples of a few we have seen before:

  • Lost metadata due to automatic overrides/failing to import to the new platform.
  • Improper testing on new features, such as a new faulty checkout.
  • Backlinks lost due to website structural changes.
  • Accidentally leaving out valuable content, such as pages from a blog.
  • Underestimating the amount of time and resources required.

The area that is the focus of this article is redirect mapping (or static/dynamic mapping), which is a custom module in Salesforce that makes page-to-page redirects manageable.

Note: If you are here because you found Salesforce’s documentation on redirects/mapping confusing then get in touch and we’ll see if we can help!

Single redirects

Salesforce has a module that allows you to enter an incoming URL and then specify a destination for that URL, which creates a simple 301/302 redirect from one page to another.

The Salesforce URL redirect form.
Single URL redirects in Salesforce.

This process can be useful for the odd page here and there, but it is by no means fit for purpose for thousands of pages during a website re-platforming.

Static Mapping

Static mapping is for when you have a lot of redirects. It allows you to create rules for specific incoming URLs which then are mapped to a unique Salesforce ID that represents a product or category within the catalogue.

This is especially useful when migrating to Salesforce, as the structure of the website is likely to change somewhat during the process.

Static mapping module Salesforce

Categories

Incoming URL: old-example.com/item/category/sub-category-1

Desired destination: new-store.com/brand/category/sub-category-1

Static mapping: /item/category/sub-category p,,,Link-Category,,cgid,sub-category-1

You can find out the ID of a category by exporting the store catalogue. However, sometimes the ID is in the URL itself and you can use some Excel-fu to extract this..

This works because the IDs within the catalogue should remain the same during the migration (or else stock management systems would need changing too).

Products

Incoming URL: old-example.com/item/category/sub-category-1/product5678

Desired destination: new-store.com/brand/category/sub-category-1/product5678

Static mapping: /item/category/sub-category/sub-category-1/product5678 p,,,Product-Show,,pid,product5678

Product mapping is the same as category mapping, except the syntax of the rule is slightly altered.

Dynamic mapping

Dynamic mapping allows you to dissect incoming URLs to identify common patterns, and then redirect multiple pages with one rule.

These rules use two types of wildcards (* and **), which are referenced by their positions {0},{1},{2} etc.:

/**/images/** s,,,,,/{0}/{1}

** matches the entire path a URL including slashes

* matches only the path between slashes

This takes everything before /images/ and places it into variable {0} and takes everything after /images/ and places it into variable {1}

Incoming URL: old-example.com/path/to/images/even/more/paths

Destination: newstore.com/path/to/even/more/paths

Useful tips

Here are some additional features that are useful that can be incorporated into the mapping:

Map query strings

Incoming URL: old-example.com/item/category/sub-category-1/product5678?trk=f7sad6s6gs78hqasa78fya8fhsa87asdhasdh7a7hafaf

Desired destination: new-store.com/brand/category/sub-category-1/product5678? f7sad6s6gs78hqasa78fya8fhsa87asdhasdh7a7hafaf

Example: /item/category/sub-category-1/product5678?trk=f7sad6s6gs78hqasa78fya8fhsa87asdhasdh7a7hafaf p,,,Product-Show,,pid,product5678,{_querystring}

Using {_querystring} copies over the parameters from the incoming URL to the new destination so legacy tracking codes remain intact.

Map to homepage

Example: /index.html p,,,Home-Show,

For when you need to map to the homepage.

Case sensitivity

Example: /item/case-insensitive i p,,,Product-Show,,pid,product5678

Adding an ‘i’ like in the example above treats mixed case URLs as one.

Map whitespace

Example: ”/item/white space here/product5678” p,,,Product-Show,,pid,product5678

Surrounding the incoming URL in speech marks allows you to redirect URLs with spaces in them.

Automate Salesforce static mapping

There are many ways you can speed the process of static mapping up; for example, you could create a simple program or even use Excel, as long as it can do the following:

  1. Extract last part of incoming URL.
  2. Use this as a destination to map the redirect to.
  3. Validate whether it exists or not by looking up the ID from a catalogue export/staging crawl.
  4. Determine whether it is a category or product.

Automatically output mapping rule based on the above.

Example of 'Salesforce redirect generator' made in Excel
Example of ‘Salesforce redirect generator’ made in Excel.

Additional features could be added such as:

  • Detect query strings
  • Detect whitespace
  • Identify common patterns for dynamic mapping opportunity

Summary

In summary, migrating to Salesforce requires a lot of thought, and extra consideration should be given to a strategy around mapping old URLs to new destinations, as there are a lot of different ways to do it and some are a lot more effective than others.

A well-devised and optimised static/dynamic mapping strategy can save you lots of time and resources, as well as ensuring past SEO efforts are retained and eliminating needless stress on servers.

Find out more about how SALT.agency can help your website with its Salesforce platform.