My website is build with Gatsby, hosted on Gatsby Cloud. I have redirected my gatsby build example.gatsbyjs.io
to my domain example.net
, no problem.
Now, I have another domain: example.com
and would like it to also redirect to example.net
. (at the moment i have 2 identical websites with just different domain extensions)
I have tried using the createRedirect action in my gatsby-node.js but it doesn't work after rebuilding and deploying
createRedirect({
fromPath: "example.net/*",
toPath: "example.com/",
isPermanent: true,
});
From my understanding createRedirect will only work within the same domain / subdomain and here I'm trying to redirect one domain to another.
I've tried using gatsby-plugin-meta-redirect and gatsby-plugin-gatsby-cloud (even if its automatically added when using gatsby cloud) to no avail.
How could i redirect one domain to another domain with gatsby cloud ? Or can i somehow make a redirect in the registrar?