Keep a migrated page's old URL as the canonical URL
On this page
Use this process when you are moving a site to StoreConnect on the same domain and want search engines to keep indexing the old URLs until cutover. A common pattern is to serve each old URL in place with a route mapping whose Type is Rewrite. While that is in place, the page’s canonical URL should be the old URL that search engines already know, such as /miami-65422.html, rather than the new /products/miami-outdoor-chair.
Canonical Path Override sets that canonical on a product or product category. StoreConnect keeps the store’s domain, the store Path (if any), and the query string, and replaces only the path:
| Page | Canonical Path Override | Canonical URL |
|---|---|---|
/products/miami-outdoor-chair |
/miami-65422.html |
https://shop.example.com/miami-65422.html |
The same page on a store with the Path au |
/miami-65422.html |
https://shop.example.com/au/miami-65422.html |
/dining-tables?products_page=2 |
/dining/tables/ |
https://shop.example.com/dining/tables?products_page=2 |
| Any | Blank | The page’s own URL |
A trailing slash is dropped, because StoreConnect redirects URLs that end in a slash and a canonical must not point at a redirect. The store’s sitemap lists the same URL as the canonical tag. The default theme uses it for both the rel="canonical" link and the og:url tag, so no theme change is needed.
Before you start
- Make sure the old path loads on every store that sells the product or shows the category. The override belongs to the record, not the store, so it applies on all of them. A Route Mapping with Store left blank covers every store. Search engines tend to ignore a canonical URL that returns a 404.
Set the override
- Open the Product or Product Category record.
-
In Canonical Path Override (
s_c__Canonical_Path_Override__c), enter the old path, starting with/. For example,/miami-65422.html.Leave out the domain and the store Path. The field rejects a domain, spaces, a query string (
?) or an anchor (#). Percent-encode any other special character, for example%20for a space. - Save the record.
- Open the product or category page on your storefront and view the page source.
The <link rel="canonical"> tag now shows the old URL, for example https://shop.example.com/miami-65422.html.
On a product page, only the product’s own override is used. On a category page, the category’s override is used.
At cutover
- Clear Canonical Path Override on each product and category that has one.
- Change the Type of each of those route mappings from
Rewriteto301 - Permanent Redirect, so the old URL redirects to the new one.
Each page’s canonical URL returns to the page’s own StoreConnect URL.
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.