Redirects

Redirects send visitors from one URL on your site to another. Use them when you move pages, retire old URLs, or point a section of your site somewhere else, without changing any content. Redirects live alongside your site’s domains under Domains, and a built-in redirect tester lets you try a URL against your rules before you save them.

Redirects for the Continuous Science Foundation site: two rules, the info pages group sending pages such as /about to the foundation’s own site, and the redirect tester.

Figure 1:Redirects for the Continuous Science Foundation site: two rules, the info pages group sending pages such as /about to the foundation’s own site, and the redirect tester.

Rules

Redirects are an ordered list of rules, each with a source path and a destination. The first rule that matches wins. A source path can capture parts of the URL and reuse them in the destination:

  • :param matches one path segment, such as /articles/:id.

  • :splat matches the rest of the path, such as /old-section/:splat.

  • :path is the whole incoming path.

Destinations must be http or https URLs. Redirects are temporary (302) by default, and the incoming query string is passed along to the destination.

Groups for whole sections

Three reserved groups redirect whole kinds of page at once. They are checked in this order:

  • $landing for the site’s landing page.

  • $info for info pages, such as an About or Author Instructions page.

  • $notFound for URLs where the site has no page.

Because rules are checked before groups, a rule can carve out an exception from a blanket $info redirect, for example keeping one info page on your site while the rest move elsewhere.

What redirects leave alone

Some paths keep working however broad your rules are. The site’s own routes (such as /api/*, /sitemap.xml, /robots.txt, /favicon.ico, and /login) are only redirected by a rule that names them exactly, so a blanket $info or $notFound rule can’t break sign-in or the sitemap. A rule that would send a visitor back to the same URL is skipped, so the same rules are safe on every domain the site is served from. Redirected URLs are left out of the sitemap, so search engines only see the pages you keep.

Article pages don’t fall back to $notFound: a mistyped article URL shows the site’s error page instead of quietly sending the reader somewhere else.

Set up the domains your site answers on in Domains, and see which articles live at which URLs in All Submissions.

Abbreviations
URL
Uniform Resource Locator