mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
7662f8fb2a
* clarify MCP returns MD * Fix doc issues surfaced by user feedback - Fix claude mcp add --header argument order: the flag must come after the positional <name> and <url> args because --header is variadic and otherwise consumes everything that follows it, causing the "missing required argument 'name'" error users reported. - Add tip to wrap iframes in Frame component to prevent overflow (user suggestion on image-embeds page). - Fix broken anchor link in quickstart CLI tab: /cli/install has no #clone-your-repository section; replaced with inline git clone instructions and a correct link to /deploy/github. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Document wide-mode behavior for side panel Wide mode hides the entire side panel (not just the TOC), including Panel components and OpenAPI request/response examples. This was undocumented and actively confused a user who couldn't understand why their OpenAPI example panels disappeared on wide-mode pages. - Fix the wide mode description in organize/pages.mdx (it previously said only the TOC was hidden, but ContentSideLayout.tsx returns null for wide/center/custom modes entirely) - Add a Note to components/panel.mdx calling out that the side panel is absent on wide, center, and custom pages Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Resolve user feedback: clarify path formats, load timing, and analytics config - react-components: add Constraints section (hooks pre-injected, no npm, no default exports) - posthog: fix default host from app.posthog.com to ph.mintlify.com (confirmed via source) - plausible: add ParamField descriptions including server field explanation - create/text: note that internal links require root-relative paths without file extensions - create/image-embeds: clarify image paths are root-relative, relative paths unsupported - create/redirects: show redirects as top-level field in full docs.json example - customize/custom-scripts: note that custom JS runs after page is interactive, applies globally Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * 💅 --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
111 lines
2.5 KiB
Plaintext
111 lines
2.5 KiB
Plaintext
---
|
|
title: "Redirects"
|
|
description: "Configure URL redirects in docs.json for moved, renamed, or deleted documentation pages to preserve SEO rankings and prevent broken links."
|
|
keywords: ["redirects"]
|
|
boost: 3
|
|
---
|
|
|
|
When you change the path of a file in your docs folder, it also changes the URL path to that page. This may happen when restructuring your docs or changing the sidebar title.
|
|
|
|
## Redirects
|
|
|
|
<Note>
|
|
Redirects **cannot** include URL anchors like `path#anchor` or query parameters like `path?query=value`.
|
|
</Note>
|
|
|
|
Add the `redirects` field to the top level of your `docs.json` file to set up redirects.
|
|
|
|
```json docs.json
|
|
{
|
|
"name": "My docs",
|
|
"redirects": [
|
|
{
|
|
"source": "/source/path",
|
|
"destination": "/destination/path"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
This redirects `/source/path` to `/destination/path`.
|
|
|
|
By default, redirects are permanent (308). To use a temporary redirect (307), set `permanent` to `false`.
|
|
|
|
```json
|
|
"redirects": [
|
|
{
|
|
"source": "/source/path",
|
|
"destination": "/destination/path",
|
|
"permanent": false
|
|
}
|
|
]
|
|
```
|
|
|
|
Both 307 and 308 preserve the HTTP method of the original request (unlike 301 and 302), making them suitable for redirecting POST requests.
|
|
|
|
### Wildcard redirects
|
|
|
|
To match a wildcard path, use `*` after a parameter. In this example, `/beta/:slug*` matches `/beta/introduction` and redirects it to `/v2/introduction`.
|
|
|
|
```json
|
|
"redirects": [
|
|
{
|
|
"source": "/beta/:slug*",
|
|
"destination": "/v2/:slug*"
|
|
}
|
|
]
|
|
```
|
|
|
|
### Partial wildcard redirects
|
|
|
|
Use partial wildcards to match URL segments that start with a specific prefix.
|
|
|
|
```json
|
|
"redirects": [
|
|
{
|
|
"source": "/articles/concepts-*",
|
|
"destination": "/collections/overview"
|
|
}
|
|
]
|
|
```
|
|
|
|
This matches any URLs with the `/articles/concepts-` path, such as `/articles/concepts-getting-started` and `/articles/concepts-overview`, and redirects them all to `/collections/overview`.
|
|
|
|
You can also substitute the captured wildcard value in the destination.
|
|
|
|
```json
|
|
"redirects": [
|
|
{
|
|
"source": "/old/article-*",
|
|
"destination": "/new/article-*"
|
|
}
|
|
]
|
|
```
|
|
|
|
This redirects `/old/article-123` to `/new/article-123`, preserving the captured value after the prefix.
|
|
|
|
### Avoid infinite redirects
|
|
|
|
To avoid infinite loops, do not create circular redirects where paths redirect back to each other.
|
|
|
|
```json
|
|
"redirects": [
|
|
{
|
|
"source": "/docs/:slug*",
|
|
"destination": "/help/:slug*"
|
|
},
|
|
{
|
|
"source": "/help/:slug*",
|
|
"destination": "/docs/:slug*"
|
|
}
|
|
]
|
|
```
|
|
|
|
## Check for broken links
|
|
|
|
Find broken links with the [CLI](/cli).
|
|
|
|
```bash
|
|
mint broken-links
|
|
```
|