Sign Up

Redirects

Redirects

From time to time you may need to redirect users from a page to another. This is especially useful when restructuring your information architecture or when migrating your docs to Doctave.

You can specify redirects in your project configuration file. Currently only internal redirects are possible.

redirects:
  - from: /docs/old_path
    to: /docs/new_path

In the example, all visitors that navigate to the /docs/old_path would get redirected to /docs/new_path.

Redirects & SEO

Doctave redirects are search engine optimized and indicate strongly that the requested content lives in another location. All redirects use the 301 status code and use a 24 hour cache expiration header.

Dynamic redirects

In addition to static redirects you may use wildcards to capture a more dynamic path to redirect from.

Wildcard redirect
redirects:
  - from: /docs/**
    to: /new_docs

The captured path can also be used in the path you're redirecting to.

Redirect all paths under /docs to a new path
redirects:
  - from: /docs/**
    to: /new_docs/:path

Any URL path that starts with /docs will now be redirected to /new_docs. For example /docs/guides/api-client will redirect to /new_docs/guides/api-client.

You may also use a stricter wildcard with a single asterisk *, for example /docs/*, which will match only to one part of a path. See below the rules for single and double asterisk wildcards.

Path/docs/**/docs/*
/
/docs
/docs/guides
/docs/guides/api-client

Redirects will be processed in the order they appear in your project file, resolving to the first one that matches.

Was this page helpful?