From dda4b2651f222821d6d20131b537d7359ed4a41a Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 18:17:37 +0000 Subject: [PATCH 1/2] Update create/redirects.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> --- create/redirects.mdx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/create/redirects.mdx b/create/redirects.mdx index 752f008e5..24b2cf525 100644 --- a/create/redirects.mdx +++ b/create/redirects.mdx @@ -21,6 +21,8 @@ Set up 301 redirects by adding the `redirects` field to your `docs.json` file. This permanently redirects `/source/path` to `/destination/path` so that you don't lose any previous SEO for the original page. +### 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 @@ -32,6 +34,34 @@ To match a wildcard path, use `*` after a parameter. In this example, `/beta/:sl ] ``` +### Partial wildcard redirects + +Use partial wildcards to match URL segments that start with a specific prefix. The pattern `prefix-*` matches any segment beginning with `prefix-` and captures the remaining portion. + +```json +"redirects": [ + { + "source": "/en/articles/9140627-*", + "destination": "/collections/overview" + } +] +``` + +This matches URLs like `/en/articles/9140627-how-to-create-collections` and `/en/articles/9140627-managing-collections`, redirecting them all to `/collections/overview`. + +You can also substitute the captured portion 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. + The destination slug cannot match to the source slug. For example, if your docs are hosted at `/docs`, avoid: ```json From 2e45950c0818388e2d1afcce54403feef8ac78a3 Mon Sep 17 00:00:00 2001 From: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> Date: Thu, 18 Dec 2025 14:20:20 -0800 Subject: [PATCH 2/2] document partial wildcard matching --- create/redirects.mdx | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/create/redirects.mdx b/create/redirects.mdx index 24b2cf525..8a3a025f7 100644 --- a/create/redirects.mdx +++ b/create/redirects.mdx @@ -36,20 +36,20 @@ To match a wildcard path, use `*` after a parameter. In this example, `/beta/:sl ### Partial wildcard redirects -Use partial wildcards to match URL segments that start with a specific prefix. The pattern `prefix-*` matches any segment beginning with `prefix-` and captures the remaining portion. +Use partial wildcards to match URL segments that start with a specific prefix. ```json "redirects": [ { - "source": "/en/articles/9140627-*", + "source": "/articles/concepts-*", "destination": "/collections/overview" } ] ``` -This matches URLs like `/en/articles/9140627-how-to-create-collections` and `/en/articles/9140627-managing-collections`, redirecting them all to `/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 portion in the destination: +You can also substitute the captured wildcard value in the destination. ```json "redirects": [ @@ -62,22 +62,23 @@ You can also substitute the captured portion in the destination: This redirects `/old/article-123` to `/new/article-123`, preserving the captured value after the prefix. - - The destination slug cannot match to the source slug. For example, if your docs are hosted at `/docs`, avoid: - ```json +### Avoid infinite redirects + +To avoid infinite loops, the destination slug cannot match the source slug. For example, if your docs are hosted at `/docs`, avoid: + +```json +"redirects": [ { "source": "/docs/:slug*", "destination": "/:slug*" } - ``` - +] +``` -## Broken links +## Check for broken links -Catch broken links with our CLI. [Install the CLI](/installation) and run the command: +Find broken links with the [CLI](/installation). ```bash mint broken-links ``` - -The CLI identifies any relative links in your docs that don't exist.