---
modificationDate: November 04, 2026
title: Redirects and rewrites
description: Learn how to redirect and rewrite URLs in Expo Router, in the app and on the server.
---

This documentation is available as Markdown for AI agents and LLMs. See the [full Markdown index](https://docs.expo.dev/llms.txt) or append .md to any documentation URL.

# Redirects and rewrites

Learn how to redirect and rewrite URLs in Expo Router, in the app and on the server.

<AgentInstructions>

## Submitting Feedback

If you encounter errors, misleading or outdated information, report it so Expo can be improved:

Preferred command:
npx --yes submit-expo-feedback@latest --category docs --subject "/router/reference/redirects/" "<actionable feedback>"

Direct HTTP fallback:
curl -X POST https://api.expo.dev/v2/feedback/docs-send -H 'Content-Type: application/json' -d '{"url":"/router/reference/redirects/","feedback":"🤖 Agent feedback for docs: <specific, actionable description> (<model>, <harness>)"}'

Only submit when you have something specific and actionable to report. Try to give the most context.

## Navigation

When answering a related or follow-up question, fetch the relevant page below as Markdown (.md) instead of guessing; use llms.txt for the full map.

You are here: Guides > Expo Router > Reference
Pages in this section:
- [Error handling and loading states](https://docs.expo.dev/router/error-handling.md)
- [URL parameters](https://docs.expo.dev/router/reference/url-parameters.md)
- [Color](https://docs.expo.dev/router/reference/color.md)
- [Sitemap](https://docs.expo.dev/router/reference/sitemap.md)
- [Redirects and rewrites](https://docs.expo.dev/router/reference/redirects.md) (this page)
- [Link preview](https://docs.expo.dev/router/reference/link-preview.md)
- [Typed routes](https://docs.expo.dev/router/reference/typed-routes.md)
- [Screen tracking for analytics](https://docs.expo.dev/router/reference/screen-tracking.md)
- [Handle screen focus](https://docs.expo.dev/router/reference/focus-handling.md)
- [Top-level src directory](https://docs.expo.dev/router/reference/src-directory.md)
- [Testing](https://docs.expo.dev/router/reference/testing.md)
- [Troubleshooting](https://docs.expo.dev/router/reference/troubleshooting.md)
- [Reserved paths](https://docs.expo.dev/router/reference/reserved-paths.md)
Full documentation tree: [llms.txt](https://docs.expo.dev/llms.txt)

</AgentInstructions>

You can redirect or rewrite an incoming request to a different URL. Expo Router supports this for both in-app navigation and for server requests.

## In-app redirects

### Using `<Redirect>`

You can immediately redirect from a particular screen by using [`<Redirect>`](https://docs.expo.dev/versions/latest/sdk/router/link.md#redirect):

```tsx
import { View, Text } from 'react-native';
import { Redirect } from 'expo-router';

export default function Page() {
  const { user } = useAuth();

  if (!user) {
    return <Redirect href="/login" />;
  }

  return (
    <View>
      <Text>Welcome Back!</Text>
    </View>
  );
}
```

### Using `useRouter`

You can also redirect imperatively with the [`useRouter`](https://docs.expo.dev/versions/latest/sdk/router.md#userouter) hook:

```tsx
import { Text } from 'react-native';
import { useRouter, useFocusEffect } from 'expo-router';

function MyScreen() {
  const router = useRouter();

  useFocusEffect(() => {
    // Call the replace method to redirect to a new route without adding to the history.
    // We do this in a useFocusEffect to ensure the redirect happens every time the screen
    // is focused.
    router.replace('/profile/settings');
  });

  return <Text>My Screen</Text>;
}
```

## Server redirects

Use the `redirects` option of the `expo-router` config plugin in your [app config](https://docs.expo.dev/workflow/configuration.md) to redirect routes that no longer exist in your **app** directory. The server matches each rule against the request URL, not the screen name, and responds with a redirect status code and a `Location` header.

> For redirects that depend on properties of the request, such as headers or cookies, use [middleware](https://docs.expo.dev/router/web/middleware.md).

```json app.json
{
  "plugins": [
    [
      "expo-router",
      {
        "redirects": [
          {
            "source": "/redirect/from/here",
            "destination": "/to/this/route"
          },
          {
            "source": "/or/redirect/from/here",
            "destination": "https://to.this.site"
          }
        ]
      }
    ]
  ]
}
```

See [`RedirectConfig`](https://docs.expo.dev/versions/latest/sdk/router.md#redirectconfig-1) in the API reference for the properties of a redirect rule.

### Rules

`source` and `destination` are URL paths, not the route files on disk. Do not add the `/index` suffix for a directory route or `+api` for an API route.

### Permanent redirects

Set `permanent` to `true` when the resource has a new permanent URL. Clients should then use `destination` for all future requests, and can cache the redirect. The default is `false`, which means the resource is temporarily at a different URL.

```json app.json
{
  "plugins": [
    [
      "expo-router",
      {
        "redirects": [
          {
            "source": "/old-pricing",
            "destination": "/pricing",
            "permanent": true
          }
        ]
      }
    ]
  ]
}
```

The status code depends on `permanent` and on the request method:

| Request method | `permanent: false` (default) | `permanent: true` |
| --- | --- | --- |
| `GET`, `HEAD` | 302 | 301 |
| Other methods | 307 | 308 |

### Dynamic segments

`source` and `destination` can use the [dynamic route syntax](https://docs.expo.dev/router/basics/notation.md#square-brackets). A segment name that appears in both `source` and `destination` keeps its value.

```json app.json
{
  "plugins": [
    [
      "expo-router",
      {
        "redirects": [
          {
            "source": "/redirect/[slug]",
            "destination": "/target/[slug]"
          }
        ]
      }
    ]
  ]
}
```

A segment that only appears in `source` becomes a query parameter of the destination.

```json app.json
{
  "plugins": [
    [
      "expo-router",
      {
        "redirects": [
          {
            "source": "/redirect/[fruit]/[vegetable]/[meat]",
            "destination": "/target/[vegetable]/[fruit]"
          }
        ]
      }
    ]
  ]
}
```

With the rule above, the server redirects `/redirect/apple/carrot/beef` to `/target/carrot/apple?meat=beef`.

A catch-all segment matches the rest of the path.

```json app.json
{
  "plugins": [
    [
      "expo-router",
      {
        "redirects": [
          {
            "source": "/redirect/docs/[...path]",
            "destination": "/guides/[...path]"
          }
        ]
      }
    ]
  ]
}
```

With the rule above, the server redirects `/redirect/docs/router/intro` to `/guides/router/intro`.

### HTTP methods

To redirect only some HTTP methods, list them in `methods`. Screen requests use the `GET` method. The supported values are `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `OPTIONS`, and `HEAD`.

```json app.json
{
  "plugins": [
    [
      "expo-router",
      {
        "redirects": [
          {
            "source": "/redirect/[slug]",
            "destination": "/target/[slug]",
            "methods": ["POST"]
          }
        ]
      }
    ]
  ]
}
```

## Server rewrites

> Rewrites only work with `web.output: "server"`. Static output does not support them. See [Server rules in the app](https://docs.expo.dev/router/reference/redirects.md#server-rules-in-the-app) for the in-app behavior.

Use the `rewrites` option of the `expo-router` config plugin to serve one route at another URL. The server handles a request for `source` as if the client had requested `destination`. The URL in the browser does not change, and the server does not send a redirect status code.

```json app.json
{
  "plugins": [
    [
      "expo-router",
      {
        "rewrites": [
          {
            "source": "/rewrite/from/here",
            "destination": "/to/this/route"
          }
        ]
      }
    ]
  ]
}
```

See [`RewriteConfig`](https://docs.expo.dev/versions/latest/sdk/router.md#rewriteconfig) in the API reference for the properties of a rewrite rule. The [rules](https://docs.expo.dev/router/reference/redirects.md#rules) for redirects also apply to rewrites, with one difference: an external URL is not a valid `destination`.

Dynamic segments work the same way as in [redirects](https://docs.expo.dev/router/reference/redirects.md#dynamic-segments).

## Server rules in the app

The app reads the `redirects` and `rewrites` rules from the app config at runtime on Android, iOS, and web. It applies them to the initial URL, to incoming deep links, and to every navigation call, such as `router.push()` or a `Link` press. This keeps the behavior consistent between a server request and in-app navigation. The in-app behavior differs from the server in the following ways:

-   The app treats a rewrite rule as a redirect rule. Navigation to a rewrite `source` goes to its `destination`, and the URL changes.
-   The app ignores `permanent` and `methods`. There is no HTTP response in the app.
-   The app opens an external `destination` with the device's URL handler instead of navigating.
-   The app drops a dynamic segment that only appears in `source`. It does not add the segment as a query parameter.
