зеркало из https://github.com/github/docs.git
1.9 KiB
1.9 KiB
Redirects
There are a number of ways to configure redirects in the site.
Local redirects
Sometimes we change the name of an article but want its old URL to redirect to its new URL. For these types of redirects, we use redirect_from
frontmatter. See /content#redirect_from for details.
External redirects
Sometimes the canonical home of some content moves outside the help site. For these types of redirects, we add entries to /lib/external-redirects.json.
Custom redirects
We also have custom routing code that dynamically handles things like moved hidden pages or deprecated products like GitHub Desktop Classic. This code lives in /middleware/redirects.js.
Autogenerated redirects
The site automatically generates a number of redirects under the hood:
Redirect from | Redirect to | Example |
---|---|---|
Path without a language prefix | Path with an English prefix | https://help.github.com/articles/set-up-git to https://help.github.com/en/articles/set-up-git |
Redirect without a language code | Path with an English prefix | https://help.github.com/mac-set-up-git to https://help.github.com/en/articles/set-up-git/ |
Enterprise path without a version | Path with the latest version | https://help.github.com/enterprise to https://help.github.com/en/enterprise/2.16 |
Enterprise path that includes /guides/ |
Path without /guides/ |
https://help.github.com/enterprise/admin/guides/installation to https://help.github.com/en/enterprise/2.16/admin/installation |
Desktop path that includes /guides/ |
Path without /guides/ |
https://help.github.com/desktop/guides/contributing-to-projects to https://help.github.com/en/desktop/contributing-to-projects |
See Debugging for info on viewing the redirects for any page.