# React Router (Remix) redirects

> Return redirects from Remix or React Router loaders and actions, choose a permanent status for URL moves, and avoid unsafe destinations.

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

Guide React Router · Remix

Return redirects from Remix or React Router loaders and actions, choose a permanent status for URL moves, and avoid unsafe destinations.

4 min

read

4

sources

Oct 24, 2026

updated

Scaplet Editorial Team

author

In one line

In Remix v2, return `redirect(url, status)` from a route loader or action; the helper defaults to 302. Use 301 only when a public URL has permanently moved. Current React Router Framework Mode uses `redirect` from `react-router` in route loaders and actions, also defaulting to 302. Keep temporary login and form-flow redirects temporary, validate user-provided destinations, and test the deployed HTTP response.

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%2Fremix%2Fredirects%20(%22React%20Router%20(Remix)%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%2Fremix%2Fredirects%20(%22React%20Router%20(Remix)%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%2Fremix%2Fredirects%20(%22React%20Router%20(Remix)%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%2Fremix%2Fredirects%20(%22React%20Router%20(Remix)%20redirects%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 4 parts, 4 minutes.

1. [Know which API your application uses 01](#know-which-api-your-application-uses)
2. [Use 301 for a permanent public URL change 02](#use-301-for-a-permanent-public-url-change)
3. [Choose the layer based on what determines the destination 03](#choose-the-layer-based-on-what-determines-the-destination)
4. [Test the response, not only in-app navigation 04](#test-the-response-not-only-in-app-navigation)

_01_Choose the API for the app version

## Know which API your application uses

Remix v2 applications import the helper from `@remix-run/node` or the relevant runtime package such as `@remix-run/cloudflare`. In the current React Router Framework Mode, import `redirect` from `react-router`. Both APIs produce a redirect response from a server-side route loader or action; you can also `throw` it to stop the loader or action early, as in a login guard. The import and route conventions depend on your installed major version.

App setup

### Remix v2

Import

`@remix-run/node` or runtime package

Where the response belongs

Route `loader` or `action`

App setup

### React Router Framework Mode

Import

`react-router`

Where the response belongs

Route module `loader` or `action`

App setup

### React Router Data Mode

Import

`react-router`

Where the response belongs

Route object loader or action

App setup

### Declarative mode (client-only routing)

Import

Navigation APIs

Where the response belongs

`redirect` is not available in Declarative mode. Use a server or hosting redirect for an HTTP URL migration.

The current React Router docs are the forward path for Remix's routing and data conventions, while Remix v2 documentation remains relevant to deployed v2 apps. Check `package.json` and your route setup before copying an import from an example.

_02_Checklist

## Use 301 for a permanent public URL change

The redirect helper defaults to [HTTP 302](/glossary/302-redirect). Pass 301 explicitly for a public URL that has permanently moved, such as a renamed documentation route or product [slug](/glossary/url-slug). Google treats 301 as a [permanent redirect](/glossary/301-redirect) signal; use a temporary status for a short-lived decision such as a user session or a form submission flow.

First_2_
Use a clear one-to-one replacement when possible. A close page helps visitors understand the move; a homepage is rarely a good destination for unrelated removed URLs.

Update [internal links](/glossary/internal-links) and canonical URLs to the destination so requests do not depend on the redirect after every click.

Next_1_
If a POST action succeeds and should prevent form resubmission, use the appropriate post/redirect/get status, commonly 303, instead of making the destination permanent.

Then_1_
A redirect can include response headers such as `Set-Cookie`; preserve session or cache headers when the request flow requires them.

React Router Framework Mode route module

```
import { redirect } from "react-router" export function loader() { return redirect("/guides/new-url", 301) }
```

Remix v2 route module

```
import { redirect } from "@remix-run/node" export function loader() { return redirect("/guides/new-url", 301) }
```

_03_A route redirect versus hosting configuration

## Choose the layer based on what determines the destination

Need

### A known old route always maps to a fixed replacement

Use

Route loader or hosting redirect rule

Reason

A static mapping is easier to inspect, and a host rule can answer before the app runs.

Need

### Destination depends on session, record, or request data

Use

Server loader or action

Reason

The route can inspect the request and choose a response.

Need

### Redirect after a successful form submission

Use

Action redirect with a post/redirect/get status

Reason

The browser reaches the result page without resubmitting the POST on refresh.

Need

### Destination comes from a return-to parameter

Use

Validated allowlist before redirecting

Reason

React Router documents that `redirect` accepts absolute URLs and that the app should validate user-supplied values; untrusted values can create an open redirect.

For large migrations, put stable path mappings in the deployment platform when it supports them. Use route code for conditional decisions rather than loading a large redirect table on every request without measuring latency.

_04_How it works

## Test the response, not only in-app navigation

1. 1

### Request the old URL directly

Open the public route in a fresh browser session or inspect it over HTTP. Check the [status code](/glossary/http-status-codes) and `Location` header; a client-side navigation can look correct even when direct requests behave differently.
2. 2

### Follow every hop

Follow the response through to the final page. Remove chains by mapping the original source directly to the final destination, and check for loops.
3. 3

### Test the real request variants

Check trailing slashes, [query parameters](/glossary/url-parameters), locale prefixes, and authenticated versus logged-out requests when they can change the route result.
4. 4

### Confirm the final URL is useful

Verify the destination returns a successful page with the expected content and canonical URL. Use Search Console URL Inspection for important migrated pages after deployment.

See [301 redirects and Google Search](/glossary/301-redirect) for permanent-move signals and [redirect chains](/seo-issues/redirect-chains) for cleanup checks.

Sources · 4

## Every fact, linked and dated.

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

- remix.run
- reactrouter.com
- google.com

1. 01 [redirect | Remix v2 Documentation](https://v2.remix.run/docs/utils/redirect) v2.remix.run · checked 2026-10-24
2. 02 [redirect | React Router](https://reactrouter.com/api/utils/redirect) reactrouter.com · checked 2026-10-24
3. 03 [Route Module | React Router](https://reactrouter.com/start/framework/route-module) reactrouter.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

Questions

## Asked a lot.

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

_01_ What status does Remix `redirect()` return by default?

Remix v2 documents a default 302 status. Pass a status such as 301 explicitly for a permanent public URL move.

_02_ How do I return a 301 from a React Router loader?

In Framework Mode, import `redirect` from `react-router` and return `redirect('/new-path', 301)` from the route loader.

_03_ Should login redirects use 301?

No. A login redirect depends on a visitor's session and is temporary. Reserve 301 for a public URL that has permanently moved.

_04_ Can React Router redirect to a URL from a query parameter?

The helper accepts absolute URLs. Validate or allowlist any user-provided return URL before redirecting to prevent open redirects.

## Keep learning

[All platform guides](/seo)

[Learn Cloudflare 301 redirects Frameworks](/seo/cloudflare/redirects) [Related Redirect chains Redirects](/seo-issues/redirect-chains) [Read next Drupal URL redirects Content management systems](/seo/drupal/redirects) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in platform guides
[Rank Math SEO plugin setup](/seo/rank-math/seo) [React lazy loading and SEO](/seo/react/lazy-loading) [Sanity SEO](/seo/sanity) [Sanity image SEO](/seo/sanity/image-seo)

Terms on this page
[302 redirect](/glossary/302-redirect) [URL slug](/glossary/url-slug) [301 redirect](/glossary/301-redirect) [Internal links](/glossary/internal-links) [HTTP status codes](/glossary/http-status-codes) [URL parameters](/glossary/url-parameters)

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
