Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions fern/products/docs/pages/seo/redirects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,31 @@ subtitle: Set up the navigation for your documentation site built with Fern Docs

## Redirects

The `redirects` object allows you to redirect traffic from one path to another. You can also use [`regex`](https://www.npmjs.com/package/path-to-regexp) within redirects.
The `redirects` object allows you to redirect traffic from one path to another. You can redirect exact paths or use dynamic patterns with [`regex`](https://www.npmjs.com/package/path-to-regexp) parameters like `:slug`.

<Tabs>
<Tab title="Redirect exact paths">
```yml title="docs.yml"

<CodeBlock title="docs.yml">
```yml
redirects:
# Exact path redirects
- source: "/old-path"
destination: "/new-path"
- source: "/incorrect/path"
destination: "/correct/path"
```
</Tab>

<Tab title="Redirect with regex">
```yml title="docs.yml"

# Regex-based redirects
- source: "/old-folder/:slug" # <- /old-folder/foo, /old-folder/bar, etc.
destination: "/new-folder/:slug"
- source: "/incorrect/:slug*" # <- /incorrect, /incorrect/foo/bar/baz, etc.
destination: "/correct/:slug*"
destination: "/correct/:slug*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- source: "/incorrect/:slug*" # <- /incorrect, /incorrect/foo/bar/baz, etc.
destination: "/correct/:slug*"
destination: "/correct/:slug*"
- source: "/old-folder/:slug*" # <- /incorrect, /incorrect/foo/bar/baz, etc.
destination: "/new-folder/:slug*"

```
</CodeBlock>

<Info>
Parameters suffixed with an asterisk (`*`) denote a match with zero or more.
</Info>

<Info>
Parameters suffixed with an asterisk (`*`) denote a match with zero or more.
</Info>
</Tab>
</Tabs>
### Setting permanent redirects

By default, the redirects implement temporary (302) redirects. If you would like to implement permanent (301) redirects, you can set `permanent: true`.

Expand Down