Skip to content

Commit ccadbcd

Browse files
authored
fix: redirects readme (#2379)
* fix: README redirects * fix: redirects readme
1 parent a0a23d2 commit ccadbcd

1 file changed

Lines changed: 45 additions & 1 deletion

File tree

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
- [Placeholders and dummy data](#placeholders-and-dummy-data)
2525
- [UI references](#ui-references)
2626
- [Diagrams](#diagrams)
27-
- [Import \& reference content](#import--reference-content)
27+
- [Import & reference content](#import--reference-content)
2828
- [Markdown partials](#markdown-partials)
2929
- [Code snippets](#code-snippets)
3030
- [From GitHub](#from-github)
@@ -35,6 +35,8 @@
3535
- [Ory Console](#ory-console)
3636
- [Navigate to Ory Console Pages](#navigate-to-ory-console-pages)
3737
- [Testing](#testing)
38+
- [Redirects](#redirects)
39+
- [How to add a redirect](#how-to-add-a-redirect)
3840
- [Formatting documentation](#formatting-documentation)
3941
- [Adding content to "Examples" page](#adding-content-to-examples-page)
4042
- [CLI and API reference - auto-generated content](#cli-and-api-reference---auto-generated-content)
@@ -476,6 +478,48 @@ To test the documentation locally:
476478
4. Create a production build to check for any technical issues, such as invalid
477479
internal links. Run `npm run build`.
478480

481+
### Redirects
482+
483+
When the URL of a document changes, you must set up a redirect to preserve SEO
484+
and prevent broken links. Without redirects, the original URL returns a 404
485+
error, breaking existing links from external sites and causing search engines to
486+
lose page authority.
487+
488+
The rule is: if the URL in the browser changes, add a redirect. If it doesn't,
489+
no redirect is required.
490+
491+
Filenames don't always determine URLs. Ory documentation uses numbered prefixes
492+
in filenames and sets URLs explicitly in the front matter. Renaming with no
493+
other changes doesn't require a redirect because the final URL stays the same.
494+
495+
You must add a redirect when you
496+
497+
- change the `slug` or `id` property in the document front matter
498+
- delete a document
499+
- move a document to a different directory (if it changes the URL path)
500+
501+
#### How to add a redirect
502+
503+
Add redirects to the vercel.json file in the repository root. Use this format:
504+
505+
```json
506+
{
507+
"redirects": [
508+
{
509+
"source": "/docs/old-path",
510+
"destination": "/docs/new-path",
511+
"permanent": false
512+
}
513+
]
514+
}
515+
```
516+
517+
- Start with permanent: false (302 redirect) until you confirm the redirect
518+
works in the preview or production environment.
519+
- Change to permanent: true (301 redirect) after you verify the redirect
520+
functions correctly.
521+
- Test the redirect in the Vercel preview deployment before merging.
522+
479523
## Formatting documentation
480524

481525
All documents and other files in this repository must be formatted with Prettier

0 commit comments

Comments
 (0)