If a change is made to an article that affects people's ability to find it, we create a redirect from any outdated versions to the current content. We might need to do this if an article's title is changed, a new version is added, or the location of the file is changed.
Redirects can be configured locally or externally.
Within the GitHub Docs, you can redirect from one file to another or from one version to another.
If you change the name of an article and want its old URL to redirect to its new URL for all versions, use the
redirect_from frontmatter with the path to the article's old name. If you change the name of an article and want different versions to redirect to different URLs, follow the steps in the "Redirects across versions" section.
In the following example, the article "All about commits" was renamed to "Creating your first commit." The
redirect_from frontmatter redirects anyone who navigates to the old article URL to the new article URL.
title: Creating your first commit
redirect_from in the GitHub Docs README file for more details.
If a URL for a page is entered without a version (
https://docs.github.com/ARTICLE instead of
https://docs.github.com/VERSION/ARTICLE), the site will automatically redirect it to the first available version of the page.
The order of precedence is specified in
lib/all-versions.js. The current order of precedence is:
- GitHub Free, GitHub Pro, or GitHub Team (
- GitHub Enterprise Cloud (
- GitHub Enterprise Server (
If a page titled
ARTICLE is only available in GitHub Enterprise Cloud and GitHub Enterprise Server, the link
https://docs.github.com/ARTICLE will automatically redirect to
https://docs.github.com/enterprise-cloud@latest/ARTICLE because GitHub Enterprise Cloud has precedence over GitHub Enterprise Server.
ARTICLE is available in Free, Pro, or Team, no redirect will occur because
fpt pages do not have a version segment, so the
fpt content at
https://docs.github.com/ARTICLE will render.
If you want the URL for one version of an article to redirect to a URL for another version or to another URL entirely, you must update the redirect-exceptions.txt file in the
For example, if you remove the Free, Pro, or Team (
fpt) version of an article, the URL will automatically redirect to the next available version of the page. If you want it to redirect to a version that is lower in the order of precedence, or to a different page entirely, you must specify an exception.
Each entry in the
redirect-exceptions file should start with the path you want to redirect to, including the version, followed by an unordered list of the paths you want to redirect from. In the following example, the paths in the unordered list will redirect to the GitHub Enterprise Cloud version of "Exporting member information for your organization."
Rarely, content will move outside the GitHub Docs site. For these types of redirects, update the
external-sites.json file in the
Each entry in the
external-sites.json file is a key value pair where the key is the path to where the content was and the value is the path to where it should redirect.