23
Domain redirects
planned
Aaron Adams
When I configure multiple domains for one site, I should be able to select a primary domain. The other domains should redirect to the primary domain.
This is not possible today because
createRedirect
only works with paths, not domains.I believe redirecting secondary domains to the primary domain is a more common use case than serving the same site from multiple domains.
Activity
Newest
Oldest
Munyaradzi Hozheri
Hey! This is to also bump this feature. We are in the process of migrating our entire site to gatsby & this feature would be great in our quest for performance & better SEO standing. We have an existing set of redirects that redirect to external sites - as it is we can not redirect to external sites. We have in excess of 3k redirects, most of which are legacy and have to point to an external site or service.
Lukas Hofer
I'd like to bump this feature request. We have multiple similar domain names (some with a dash, some without) and we'd like to redirect all of them to a main domain.
J
Jerome Dahdah
Hey! We have multiple country-specific domains that redirect to localized subdirectories of the main website. So:
https://www.example.com/ → https://www.example.com/en/
https://www.example.com/* → https://www.example.com/en/*
https://www.example.de/ → https://www.example.com/de/
https://www.example.de/* → https://www.example.com/de/*
https://www.example.fr/ → https://www.example.com/fr/
https://www.example.fr/* → https://www.example.com/fr/*
etc. We also have a few vanity URLs that need to be redirected similarly.
This is super easy to do with Netlify (docs: https://docs.netlify.com/routing/redirects/redirect-options/#domain-level-redirects). Right now we are using the Netlify-specific
_redirects
file for those redirects, while we have moved everything else over to createRedirect
in gatsby-node.js for a more idiomatic Gatsby approach. This is the only technical restraint preventing us from making the switch from Netlify to Gatsby Cloud.Joel Smith
planned
Slight adjustment. We've added the ability to redirect the provided url (sitename.gatsbyjs.io) but not other custom domains. Very possible and we'll add it to the roadmap!
S
Shruti Chaturvedula
complete
We now support domain redirects
D
David
+1 This is desperately needed, for a project migrating from old server to Gatsby host. We rebuild the site using Gatsby, and the URL structure has changed. We need to redirect from a few sub-domains (alias) to the "apex" domain. For example, from "fr.example.com", "en.example.com", etc. to "example.com". As others mentioned, at the moment, only "www" redirect is added automatically when adding customer domain.
Aaron Adams
Hey, I found another site that could use this feature 😉

Gregory Hardy
should redirect the default gatsbyjs.io domain too
J
James Rotering
I was just dropping by to make the same request. Until gatsby supports this, I'm working around it by 1) using canonical meta tags, and 2) redirecting in the browser when users use the domains that should be getting automatically redirected.
Load More
→