# Gatsby redirects

> Create Gatsby redirect rules, make sure your hosting adapter serves them, and test permanent URL changes after deployment.

Canonical: https://scaplet.com/seo/gatsby/redirects

Guide Gatsby · URL changes

Create Gatsby redirect rules, make sure your hosting adapter serves them, and test permanent URL changes after deployment.

3 min

read

4

sources

Oct 24, 2026

updated

Scaplet Editorial Team

author

In one line

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.

30-second check

## Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fgatsby%2Fredirects%20(%22Gatsby%20redirects%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fgatsby%2Fredirects%20(%22Gatsby%20redirects%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fgatsby%2Fredirects%20(%22Gatsby%20redirects%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fgatsby%2Fredirects%20(%22Gatsby%20redirects%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 3 parts, 3 minutes.

1. [Define the redirect in gatsby-node 01](#define-the-redirect-in-gatsby-node)
2. [Make the hosting platform serve the rule 02](#make-the-hosting-platform-serve-the-rule)
3. [Validate a Gatsby URL migration 03](#validate-a-gatsby-url-migration)

_01_Checklist

## Define the redirect in gatsby-node

Gatsby exposes `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](/glossary/soft-404).

First_2_
`isPermanent` defaults to a [temporary redirect](/glossary/302-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.

Gatsby says to keep the redirects configuration in sync with the [trailing slash](/glossary/trailing-slash) configuration from the Gatsby Config API, and with your host's URL behavior.

Next_2_
`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.

Do not redirect deleted content to an unrelated page; return a real 404 or 410 when there is no useful replacement.

Then_1_
Avoid chains: update old rules to point directly at the current destination.

gatsby-node.js

```
exports.createPages = ({ actions }) => { const { createRedirect } = actions createRedirect({ fromPath: '/old-guides/redirects', toPath: '/seo/gatsby/redirects', isPermanent: true, redirectInBrowser: false, }) }
```

_02_Check the whole redirect path

## Make the hosting platform serve the rule

Gatsby's `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.

Layer

### Gatsby build

Question

Did the rule run?

Evidence

Build output or adapter-generated redirect artifact

Layer

### Host/CDN

Question

Does the deployed host implement it?

Evidence

Host config or adapter docs

Layer

### HTTP response

Question

Does the old URL return a redirect status?

Evidence

`curl -I` against production

Layer

### Destination

Question

Does it resolve directly to the right canonical page?

Evidence

Final URL, status, content, and [canonical tag](/glossary/canonical-url)

**A Gatsby action is not the response**The `createRedirect` API records the intended mapping. The deployment layer has to turn it into a redirect users and crawlers receive.

Adapters 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.

_03_How it works

## Validate a Gatsby URL migration

1. 1

### Inventory old paths

Export the old URLs and map each to its equivalent new page. Preserve [query parameters](/glossary/url-parameters) only when the destination uses them.
2. 2

### Build and deploy

Check the adapter or host output for the redirect rules, then publish the deployment.
3. 3

### Request each old URL

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.
4. 4

### Update discovery signals

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](/seo/gatsby), [XML sitemaps](/glossary/xml-sitemap), and [canonical URLs](/glossary/canonical-url).

Questions

## Asked a lot.

3 questions people ask next, answered from the sources on this page.

_01_ How do I add a 301 redirect in Gatsby?

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.

_02_ Why does my Gatsby redirect work locally but not in production?

The production host may not implement Gatsby’s redirect definitions. Check the adapter and hosting configuration, then test the public HTTP response.

_03_ Should I redirect every removed Gatsby page to the homepage?

No. Redirect to a closely equivalent replacement. If none exists, return a real not-found or gone response rather than a misleading destination.

Sources · 4

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- gatsbyjs.com
- google.com

1. 01 [Working with Redirects and Rewrites (Gatsby Cloud) | Gatsby Docs](https://www.gatsbyjs.com/docs/how-to/cloud/working-with-redirects-and-rewrites/) gatsbyjs.com · checked 2026-10-24
2. 02 [createRedirect action | Gatsby Docs](https://www.gatsbyjs.com/docs/reference/config-files/actions/) gatsbyjs.com · checked 2026-10-24
3. 03 [Adapters | Gatsby Docs](https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/adapters/) gatsbyjs.com · checked 2026-10-24
4. 04 [Redirects and Google Search | Google Search Central](https://developers.google.com/search/docs/crawling-indexing/301-redirects) developers.google.com · checked 2026-10-24

## Keep learning

[All platform guides](/seo)

[Learn Gatsby SEO Frameworks](/seo/gatsby) [Related Canonical URL Crawling and indexing](/glossary/canonical-url) [Read next SvelteKit redirects Frameworks](/seo/sveltekit/redirects) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in platform guides
[Framer XML sitemap](/seo/framer/xml-sitemap) [Gatsby SEO](/seo/gatsby) [Ghost SEO](/seo/ghost) [Ghost AMP](/seo/ghost/amp)

Terms on this page
[Soft 404](/glossary/soft-404) [302 redirect](/glossary/302-redirect) [Trailing slash in URLs](/glossary/trailing-slash) [Canonical URL](/glossary/canonical-url) [URL parameters](/glossary/url-parameters) [XML sitemap](/glossary/xml-sitemap)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
