> 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: Migrate a Wix Site to a Headless Project

## Article: Migrate a Wix Site to a Self-Managed Headless Project

## Article Link: https://dev.wix.com/docs/go-headless/self-managed-headless/get-started/migrate-from-an-existing-wix-site/migrate-a-wix-site-to-a-headless-project.md

## Article Content:

# Migrate a Wix Site to a Self-Managed Headless Project

Replace your editor-built pages with your own externally hosted frontend, and keep managing your business from the same dashboard. Your data and business logic stay exactly the same, now running as your project's backend.

Most of the work happens safely before launch. Only the domain switch changes your live site, and it happens in a single coordinated step. To learn more, see [About Wix Site Migration to a Self-Managed Headless Project](https://dev.wix.com/docs/go-headless/self-managed-headless/get-started/migrate-from-an-existing-wix-site/about-wix-site-migration-to-a-headless-project.md).

When you're done:

- Your externally hosted frontend serves your public website on your main domain, such as `www.example.com`.
- Your project serves its Wix-hosted pages and backend on a subdomain, such as `checkout.example.com`.
- All of your business data stays in the same project.

## Before you begin

Make sure you have:

- A frontend built to replace your editor-built pages as your public website, that already calls your project's APIs through a [headless client](https://dev.wix.com/docs/go-headless/authentication/setup/set-up-a-headless-client.md). If you haven't built one yet, see [Add a Frontend to an Existing Wix Site](https://dev.wix.com/docs/go-headless/self-managed-headless/get-started/add-a-frontend-to-an-existing-wix-site.md).
- An external host, a hosting provider outside of Wix, such as Vercel, Netlify, or AWS, to deploy your frontend to.
- A subdomain planned for your project, such as `checkout.example.com`.
- Access to your domain's DNS settings, usually available through your domain registrar or DNS provider, such as GoDaddy, Namecheap, or Cloudflare. If someone else manages your domain, such as an IT team or agency, arrange access with them.

Confirm that you're working with your production site, not a proof-of-concept or test site in the same account.

## Step 1 | Build and test your frontend on a preview address

Do everything in this step while your editor-built site keeps serving your main domain. Nothing here affects your live website.

1. Finish and test your frontend on a preview or staging address from your external host.
1. In your project's **[Headless Settings](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Foauth-apps-settings)**, select your headless client's settings, then:
    1. Add your preview address to your **[Allowed redirect domains](https://dev.wix.com/docs/go-headless/authentication/setup/allow-redirect-uris-and-domains.md)**.
    1. Add your preview login callback to your **[Authorization redirect URIs](https://dev.wix.com/docs/go-headless/authentication/setup/allow-redirect-uris-and-domains.md)**. For example, `https://preview.example.com/login/callback`.
1. Set your **[Frontend link](https://dev.wix.com/docs/go-headless/project-management/add-a-frontend-link.md)** to your preview address.
1. Confirm that your frontend's API calls correctly read and write your project's data.
1. 24 to 48 hours before launch, note the current DNS `TTL` value on your main domain's record, such as `www.example.com`, then lower it to 300 seconds. `TTL` controls how long other computers on the internet cache your record before rechecking it, so a lower value means the switch in [Step 4](#step-4--switch-your-domains) reaches visitors in minutes instead of gradually over a day.

At the end of this step, your live website stays unchanged, and your frontend works correctly using your preview address.

> **Note:** This test can confirm Wix-hosted pages work, but not what your visitors eventually see. Wix-hosted pages still load from your current domain instead of your future subdomain, since that switch doesn't happen until Step 4. Wix returns visitors to your preview address when the flow finishes.

## Step 2 | Deploy your frontend to your external host

Deploy your frontend to your external host, and confirm it loads correctly at the temporary address your host assigns, before you connect your own domain. Don't change any DNS or domain settings until you've verified the deployment.

## Step 3 | Add your production addresses to your headless client

1. In your project's **Headless Settings**, select your headless client's settings, then add your production addresses:
    - **Allowed redirect domains**: Your production frontend hostnames. Include both `www` and the apex domain if you use both. For example, `www.example.com` and `example.com`.
    - **Authorization redirect URIs**: Your exact production login callback URLs. For example, `https://www.example.com/login/callback`.
1. Set your **Frontend link** to your production frontend URL. For example, `https://www.example.com`.
1. Leave **Login URL** empty, unless you host a [custom login page](https://dev.wix.com/docs/go-headless/authentication/members/custom-login-page/set-your-custom-login-page-url.md) on your frontend, in which case set it to that page's URL. If you set it to a callback path instead, Wix can build invalid login URLs by appending paths to that value.
1. Click **Save**.

## Step 4 | Switch your domains

<blockquote class="caution">

__Caution:__
This step changes your live site's domain. Don't start it until your production frontend is deployed and verified. Complete the whole step from start to finish without stopping, because your public website and Wix-hosted pages are briefly in transition until every change propagates.

</blockquote>

Your main domain moves to your external host, and your Wix subdomain becomes your project's new primary domain, the address your project actually serves pages from. Wix-hosted pages like checkout and login load there instead of your old domain.

Follow the steps in order. If you point your main domain at your external host before you change the primary domain on Wix, Wix won't redirect your main domain to your subdomain during the switch.

1. At your domain registrar, point your main domain's `CNAME` or `A` record at your external host:
    - Point your `www` `CNAME` record or your apex `A` record to your external host. For example, `www.example.com` or `example.com`, respectively.
    - Leave your `MX`, `SPF`, `DKIM`, and `DMARC` records unchanged, so your email keeps working.
1. In your project dashboard, go to **Settings** > **Domains**. Connect your Wix subdomain, for example `checkout.example.com`, and set it as the project's **primary domain**. Complete any DNS steps Wix provides for the subdomain.
1. Unassign your main domain, and its apex domain if connected, from your project. For example, `www.example.com` and `example.com`, respectively.
1. On your host, set up permanent (301) redirects for both of the following:
    - From variations of your address, such as with or without `www`, or `http` instead of `https`, to your single canonical address, the official version search engines should use. For example, redirect `http://www.example.com` to `https://www.example.com`, and `example.com` to `www.example.com`.
    - If a page's path is different in your new frontend than it was on your editor-built pages, redirect from the old path to the new path.

> **Note:** Your external host needs a valid HTTPS certificate for your main domain, and Wix needs to issue one for your subdomain after you connect it. Hosts usually issue the certificate once your domain points at them, and Wix issues yours automatically. Until each certificate is ready, visitors can see a security warning.

DNS can take up to 48 hours to propagate, though the lowered `TTL` from [Step 1](#step-1--build-and-test-your-frontend-on-a-preview-address) speeds this up. Until it does, different visitors can briefly see different things at `www.example.com`, depending on how quickly their own DNS cache picks up the change, so don't be alarmed if some visitors still reach your old setup for a while.

At the end of this step, your main domain, such as `www.example.com`, serves your frontend, and your Wix subdomain, such as `checkout.example.com`, is your project's primary domain and serves your project.

## Step 5 | Set your Wix pages domain

Point the **Wix pages domain** setting at your subdomain, so that visitors stay on your subdomain, rather than a default Wix address, during Wix-hosted flows, such as checkout and login.

1. In your project's Headless Settings, go to the **Manage URLs** section.
1. In the **Wix pages domain** section, click **Manage domain** and set your subdomain. For example, `checkout.example.com`. For details, see [Set a Domain for Wix-Hosted Pages](https://dev.wix.com/docs/go-headless/business-solutions/wix-hosted-pages/set-a-domain-for-wix-hosted-pages.md).
1. Confirm your subdomain appears under **Wix pages domain**.

## Step 6 | Verify your flows end to end

On your production frontend, test each flow:

- Browse the public website: Loads your frontend.
- Request `http` or another variation of your domain, such as the apex instead of `www`: Redirects to your canonical address. For example, from `http://www.example.com` to `https://www.example.com`.
- Request an old Wix page path: Redirects to the matching frontend page, or an intentional 404.
- Start and complete checkout: Redirects to your subdomain then back to your frontend.
- Log in as a member: Redirects to your subdomain to log in, then a callback to your frontend.
- Open a member account page: Redirects to your subdomain, then back to your frontend.
- Call your project's backend: Confirm any HTTP functions or other backend URLs still respond correctly, and update them if their domain changed.
- Send and receive email: Still works, because you left your email DNS records unchanged.

## Step 7 | Clean up after launch

Now that you've launched, confirm everything is working correctly and remove any settings you no longer need.

- Monitor your Wix-hosted flows, such as checkout and login, for 24 to 48 hours.
- Confirm the redirects to your canonical address and from old page paths, using Google Search Console and old bookmarks.
- Restore your DNS `TTL` value to what you noted in [Step 1](#step-1--build-and-test-your-frontend-on-a-preview-address), before you lowered it.
- Remove any preview addresses you no longer need from your headless client's redirect settings.

## Step 8 | (Optional) Support multiple regional frontend domains

If your frontend uses several regional domains, such as `.com`, `.eu`, and `.cz`, a single headless client and Wix subdomain can serve all of them:

- Point each region's `CNAME` or `A` record at your external host.
- Add every frontend hostname to your **Allowed redirect domains**.
- Add every regional login callback to your **Authorization redirect URIs**.
- Keep a single Wix subdomain for all regions.
- In your code, set your redirect session's return URL and your login callback URL from `window.location.origin` on each redirect, so visitors return to the region they came from.

## See also

- [About Wix Site Migration to a Self-Managed Headless Project](https://dev.wix.com/docs/go-headless/self-managed-headless/get-started/migrate-from-an-existing-wix-site/about-wix-site-migration-to-a-headless-project.md)
- [Add a Frontend to an Existing Wix Site](https://dev.wix.com/docs/go-headless/self-managed-headless/get-started/add-a-frontend-to-an-existing-wix-site.md)
- [Set a Domain for Wix-Hosted Pages](https://dev.wix.com/docs/go-headless/business-solutions/wix-hosted-pages/set-a-domain-for-wix-hosted-pages.md)
- [Allow Redirect URIs and Domains](https://dev.wix.com/docs/go-headless/authentication/setup/allow-redirect-uris-and-domains.md)
- [Add a Frontend Link](https://dev.wix.com/docs/go-headless/project-management/add-a-frontend-link.md)