You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/products/docs/pages/seo/redirects.mdx
+17-18Lines changed: 17 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,32 +5,31 @@ subtitle: Set up the navigation for your documentation site built with Fern Docs
5
5
6
6
## Redirects
7
7
8
-
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.
8
+
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`.
9
9
10
-
<Tabs>
11
-
<Tabtitle="Redirect exact paths">
12
-
```yml title="docs.yml"
10
+
11
+
<CodeBlocktitle="docs.yml">
12
+
```yml
13
13
redirects:
14
+
# Exact path redirects
14
15
- source: "/old-path"
15
16
destination: "/new-path"
16
-
- source: "/incorrect/path"
17
-
destination: "/correct/path"
18
-
```
19
-
</Tab>
20
-
21
-
<Tab title="Redirect with regex">
22
-
```yml title="docs.yml"
17
+
- source: "/old-folder/path"
18
+
destination: "/new-folder/path"
19
+
20
+
# Regex-based redirects
23
21
- source: "/old-folder/:slug"# <- /old-folder/foo, /old-folder/bar, etc.
24
22
destination: "/new-folder/:slug"
25
-
- source: "/incorrect/:slug*"# <- /incorrect, /incorrect/foo/bar/baz, etc.
26
-
destination: "/correct/:slug*"
23
+
- source: "/old-folder/:slug*"# <- /incorrect, /incorrect/foo/bar/baz, etc.
24
+
destination: "/new-folder/:slug*"
27
25
```
26
+
</CodeBlock>
27
+
28
+
<Info>
29
+
Parameters suffixed with an asterisk (`*`) denote a match with zero or more.
30
+
</Info>
28
31
29
-
<Info>
30
-
Parameters suffixed with an asterisk (`*`) denote a match with zero or more.
31
-
</Info>
32
-
</Tab>
33
-
</Tabs>
32
+
### Setting permanent redirects
34
33
35
34
By default, the redirects implement temporary (302) redirects. If you would like to implement permanent (301) redirects, you can set `permanent: true`.
0 commit comments