Redirect Object


A redirect sends a visitor who requests one path on a site to another path or URL.

Redirects keep old links working after a page is renamed or removed, consolidate duplicate URLs, and point a whole section of a site somewhere else. A redirect returns a 301 permanent redirect, takes effect on the live site immediately with no site publish, and takes precedence over a page that exists at the same path.

A redirect either matches its from path exactly, or matches everything under it when options.groupRedirect is true. A redirect scoped to a language applies to that language version of a multilingual site, and one with no language applies to every language.

Properties
createdDatestringRead-onlyformat date-time

Date and time the redirect was created.

Not returned by Create Redirect. Call Get Redirect or List Redirects to retrieve it.


fromstringmaxLength 950

Path on the site that the redirect starts from, URL-encoded. For example, /old-page.

Can't be the site root. A path that differs from another redirect's from path only by a trailing slash counts as the same path.

For a redirect scoped to a language, specify the path with or without the language prefix: the prefix is stripped, so a fr redirect from /fr/about is stored and returned as /about.


idstringformat GUID

Redirect ID.

You can specify your own ID when creating a redirect. When omitted, an ID is generated.


languagestringminLength 2maxLength 5

Language version of a multilingual site that the redirect applies to, as a 2-letter language code or a language tag. For example, fr or en-US.

When omitted, the redirect applies to every language on the site. A redirect scoped to a language conflicts only with redirects in the same language and with redirects that apply to every language.

Deleting a redirect scoped to a language stops it taking effect, but it can still appear in List Redirects.


optionsRedirectOptions

How the redirect matches the paths a visitor requests.


tostringmaxLength 4096

Where the redirect sends the visitor, URL-encoded. Either a path on the site, such as /new-page, or a full URL, such as https://example.com/page.

Did this help?