Migrate Shopify to netlify for headless solution with same domain

Hello ! I will try to be the most clear possible.

My use case.

  • I have a shopify ecom.
  • I want to migrate into a new website from netlify.
  • I want to do it incrementally.
  • Having Home page and others still on shopify hosting
  • Having some other on netlify. When a user try to access to an old page. I will redirect from netlify to shopify hosting.

My question

Is there a way to keep the same domain between them? Having mysite.fr when coming on netlify page and same when redirect to shopify. I don’t think it’s possible based on my search. But I am definitely not good enough on it.

Thank’s again for your answers! If you have any docs for me

Hey @f3ltron,
You can do this by setting the custom domain on your Netlify site and then creating a netlify.toml file or _redirects file where you proxy to Shopify under the hood for old pages. It’d be easier to show you if you share your actual URLs, but as an example:

  • at Netlify, you’ll have mysite.fr set on my-store.netlify.app
  • you’ll have some pages at Netlify, like my-store.netlify.app/shoes and my-store.netlify.app/socks that can be accessed from mysite.fr/shoes and mysite.fr/socks
  • for older pages, you’ll have a _redirects file like this:
/shirts   https://shopify-store-url.com/shirts   200!
/pants    https://shopify-store-url.com/pants   200!

This will make it so that a visitor to mysite.fr/shirts will see what’s hosted on your Shopify site.

These docs explain in more detail:

Please let us know is this helps or if you have other questions.

2 Likes

Thank’s a lot for your answer it looks exactly the answer for my question. I will try it as soon as possible!

1 Like

Hello Jen I have tried your solution and put a _rediects file in the root folder of my nuxt project and inside my static folder (I don’t know where it should be)

I am using nuxt and nuxt generate

my _redirects file:

/shirts https://melissacasilda.myshopify.com 200

But even if i put 200 it redirect to the website and not just get the content from it

Ok my bad its working well it’s just that shopify has a password protect…
Thanks :slight_smile:

1 Like