> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/sample-flows.md

## Article Content:

# URL Mapping: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Migrate a store and keep its product URLs

A Wix user moves a store to Wix from a platform where product pages live at `/products/<slug>`. By default, the Wix site serves them under its product page's path prefix instead, such as `/product-page/<slug>`. Setting the Stores product pattern to match the old platform keeps every product's URL the same, so only products whose slug changed during the import need a redirect.

> **Prerequisite:** The site has no URL mapping for `wix.stores.sub_pages.product` yet.

To migrate a store and keep its product URLs:

1. Call [Create URL Mapping](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/create-url-mapping.md) with `key` set to `wix.stores.sub_pages.product`, and a `urlMapping` whose `mapping` is `products/{{slug}}`. For example:

    ```json
    {
      "key": "wix.stores.sub_pages.product",
      "urlMapping": {
        "key": "wix.stores.sub_pages.product",
        "mapping": "products/{{slug}}"
      }
    }
    ```

1. Import the products, and list each product whose slug on Wix differs from its slug on the old platform, with both slugs.
1. Call [Build Customized URL](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/build-customized-url.md) with the same `key`, and an `itemsData` entry with the Wix `slug` of each of those products. The response's `urls` are in the same order as `itemsData`, so pair each URL with its product's old path, such as `/products/red-shoes-1`.
1. Call [Bulk Create Redirects](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/bulk-create-redirects.md) in the SEO Redirects API with the pairs, as `from` and `to`, in batches of up to 100. Some redirects in a batch can fail while the rest succeed, so check `results` and `bulkActionMetadata` in each response and retry the failed ones.

## Change a URL pattern on a published site

A Wix user set the Blog post pattern to `blog/{{slug}}` and now wants posts to move to `articles/{{slug}}`. The new URLs are live as soon as the pattern changes, and the old URLs stop working, so build the old URLs first and redirect them to the new ones.

> **Prerequisite:** The site already has a URL mapping for `wix.blog.sub_pages.post`.

To change a URL pattern on a published site:

1. Call [Get URL Mapping](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/get-url-mapping.md) with `key` set to `wix.blog.sub_pages.post`, and keep the `urlMapping` from the response.
1. Collect the `slug` of every post on the site, using [List Posts](https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/list-posts.md) in the Wix Blog API.
1. Call [Build Customized URL](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/build-customized-url.md) with the same `key` and an `itemsData` entry with each post's `slug`, such as `{ "itemData": { "slug": "my-first-post" } }`. Keep the returned `urls` as the old URLs. Send up to 10,000 items per request.
1. Call [Update URL Mapping](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/update-url-mapping.md) with the same `key`, passing the whole `urlMapping` you retrieved with `mapping` set to `articles/{{slug}}`.
1. Call [Build Customized URL](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/build-customized-url.md) again with the same `itemsData`, in the same batches. The returned `urls` are the new URLs, in the same order as the old ones.
1. Call [Bulk Create Redirects](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/bulk-create-redirects.md) in the SEO Redirects API with each old URL as `from` and its new URL as `to`, in batches of up to 100. Some redirects in a batch can fail while the rest succeed, so check `results` and `bulkActionMetadata` in each response and retry the failed ones.

## Export item page URLs

An app generates a product feed or an external sitemap and needs the full URL of every product page. [Build Customized URL](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/build-customized-url.md) returns them in bulk from the site's pattern, so the app doesn't have to rebuild the pattern itself.

> **Prerequisite:** The site has a URL mapping for `wix.stores.sub_pages.product`. [Build Customized URL](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/build-customized-url.md) doesn't build default URLs.

To export item page URLs:

1. Call [Get URL Mapping](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/get-url-mapping.md) with `key` set to `wix.stores.sub_pages.product`, and read `variables` from the response to learn which values each item needs.
1. Collect those values for every product, using [Query Products](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/products-v3/query-products.md) in the Wix Stores Catalog API. Values are inserted as is, without URL encoding, so make sure each value is URL-safe.
1. Call [Build Customized URL](https://dev.wix.com/docs/api-reference/business-management/seo/url-mapping-v1/build-customized-url.md) with the same `key`, an `itemsData` entry for each product, and `options.baseUrl` set to the site's URL, such as `https://www.my-store.com/`. Send up to 10,000 items per request.
1. Match the returned `urls` to your products by position, and add them to the feed or sitemap.