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
+1-40Lines changed: 1 addition & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,46 +5,7 @@ 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 redirect exact paths or use dynamic patterns with [`regex`](https://www.npmjs.com/package/path-to-regexp) parameters like `:slug`.
9
-
10
-
11
-
<CodeBlocktitle="docs.yml">
12
-
```yml
13
-
redirects:
14
-
# Exact path redirects
15
-
- source: "/old-path"
16
-
destination: "/new-path"
17
-
- source: "/old-folder/path"
18
-
destination: "/new-folder/path"
19
-
20
-
# Regex-based redirects
21
-
- source: "/old-folder/:slug"# <- /old-folder/foo, /old-folder/bar, etc.
22
-
destination: "/new-folder/:slug"
23
-
- source: "/old-folder/:slug*"# <- /incorrect, /incorrect/foo/bar/baz, etc.
24
-
destination: "/new-folder/:slug*"
25
-
```
26
-
</CodeBlock>
27
-
28
-
<Info>
29
-
Parameters suffixed with an asterisk (`*`) denote a match with zero or more.
30
-
</Info>
31
-
32
-
### Setting permanent redirects
33
-
34
-
By default, the redirects implement temporary (302) redirects. If you would like to implement permanent (301) redirects, you can set `permanent: true`.
35
-
36
-
<CodeBlock title="docs.yml">
37
-
```yml
38
-
redirects:
39
-
- source: "/old-subdomain"
40
-
destination: "/new-subdomain"
41
-
permanent: true
42
-
```
43
-
</CodeBlock>
44
-
45
-
<Note title="Subpaths">
46
-
If your docs are hosted on a subpath (like `buildwithfern.com/learn`), be sure to include the subpath in the redirect.
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`.
2
+
3
+
If your docs are hosted on a subpath (like `buildwithfern.com/learn`), include the subpath in both the source and destination paths.
4
+
5
+
6
+
<CodeBlocktitle="docs.yml">
7
+
```yml
8
+
redirects:
9
+
# Exact path redirects
10
+
- source: "/old-path"
11
+
destination: "/new-path"
12
+
- source: "/old-folder/path"
13
+
destination: "/new-folder/path"
14
+
permanent: true
15
+
16
+
# Regex-based redirects
17
+
- source: "/old-folder/:slug"# <- /old-folder/foo, /old-folder/bar, etc.
18
+
destination: "/new-folder/:slug"
19
+
- source: "/old-folder/:slug*"# <- /incorrect, /incorrect/foo/bar/baz, etc.
20
+
destination: "/new-folder/:slug*"
21
+
```
22
+
</CodeBlock>
23
+
24
+
<Info>
25
+
Parameters suffixed with an asterisk (`*`) match zero or more path segments, capturing everything that follows in the URL. Use this when redirecting entire folder structures while preserving nested paths.
0 commit comments