Gatsby build
- Question
- Did the rule run?
- Evidence
- Build output or adapter-generated redirect artifact
Create Gatsby redirect rules, make sure your hosting adapter serves them, and test permanent URL changes after deployment.
Gatsby creates redirect definitions with its createRedirect action, usually from gatsby-node.js. A definition alone does not guarantee a live HTTP redirect: the deployment platform or adapter must implement it. Use a permanent server-side redirect for a URL that has moved for good, map each old route to its closest replacement, and test the deployed response and final destination.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
createRedirect as an action in its Node APIs. Gatsby's redirect guide puts the calls inside createPages in gatsby-node.js. The target should be the closest surviving page; sending every removed URL to the home page can confuse visitors and may be treated as a soft 404.isPermanent defaults to a temporary redirect. Set isPermanent: true only when the old URL has actually been replaced for the long term. fromPath must start with a forward slash, and toPath is the URL of a created page.ignoreCase, force and statusCode are not part of the Gatsby API. Only some plugins and adapters implement them, so check your host's docs before relying on them.exports.createPages = ({ actions }) => {
const { createRedirect } = actions
createRedirect({
fromPath: '/old-guides/redirects',
toPath: '/seo/gatsby/redirects',
isPermanent: true,
redirectInBrowser: false,
})
}createRedirect reference says redirects must be implemented by your deployment platform, using an adapter or plugins. Its page lists gatsby-plugin-meta-redirect, which generates meta redirect HTML files for redirecting on any static file host, and points to the source of gatsby-adapter-netlify to see how Netlify does it. The docs also say redirects work out of the box on Gatsby Cloud, but Gatsby's docs site now carries a banner about migrating to Netlify, so don't plan around Gatsby Cloud. On another host, configure that host's redirect file or adapter and confirm it emits an HTTP response. A meta or client-side redirect is not the same as a server response; prefer a server-side redirect.curl -I against productionAdapters were added in gatsby@5.12.0. Per Gatsby's adapters guide, an adapter turns Gatsby's production output into something your platform understands and applies redirects and rewrites; the official adapter listed there is gatsby-adapter-netlify, with community adapters on npm under gatsby-adapter. Installing one does not prove the old path returns the intended response, so keep the curl -I check in a migration smoke test.
Export the old URLs and map each to its equivalent new page. Preserve query parameters only when the destination uses them.
Check the adapter or host output for the redirect rules, then publish the deployment.
Use curl -I https://example.com/old-path and confirm a server-side 301 or 308 for permanent moves, with a Location pointing to the intended page.
Update internal links and the sitemap to use final URLs. Recheck a sample for loops, chains, 404s, and incorrect host or slash variants.
Google's indexing pipeline uses a permanent redirect as a signal that the destination should be canonical. For nearby implementation guides, see Gatsby SEO, XML sitemaps, and canonical URLs.
3 questions people ask next, answered from the sources on this page.
Call Gatsby’s createRedirect action with fromPath, toPath, and isPermanent: true (the default is temporary), then ensure your deployment adapter or host implements the redirect.
The production host may not implement Gatsby’s redirect definitions. Check the adapter and hosting configuration, then test the public HTTP response.
No. Redirect to a closely equivalent replacement. If none exists, return a real not-found or gone response rather than a misleading destination.
Run the free audit, then approve the fixes. Every change can be undone.