The Redirect Object

Redirect objects may be entered by matching a path to a target URL or to a resource and a resourceId.

country
Optional ISO-3166 alpha-2 country code (e.g. GB).
Applicable to sites with more than one locale. May be used in conjunction with language to restrict the redirect rule to site locales matching both language and country codes. If supplied, a languagecode is required.
createdOn read-only
The datetime in ISO-8601 format when the Redirect rule was created (e.g. 2024-04-28T01:50:08+01:00).
id read-only
The Redirect ID is an unsigned 64-bit integer, which is unique across all Redirects and all Evance Accounts - no other Redirect on our Platform will have the same id.
language
Optional ISO-639-1 two letter language code (e.g. en).
Applicable to sites with more than one locale. May be used to restrict the redirect rule to site locales matching language only. Or, may also be used in conjunction with country to restrict the redirect rule to site locales matching both language and country codes.
path required
The URL path to redirect from. When the user visits this path, they will be redirected to the target/ resource.
  • The path may not include query strings.
  • If supplied as an absolute URL, only it's path will be saved.
  • Locale prefixes (e.g. /en-us) will be removed from the path and stored in the language and country properties.
  • Paths may not reference /admin or /api URLs, and may be ignored when referencing other reserved routes.
resource required
The redirect may be associated with a dynamic resource, or a fixed url. The available values for the resource are:
  • page
    A dynamic resource. Supply the page's id in the resourceId property.
  • category
    A dynamic resource. Supply the category's id in the resourceId property.
  • product
    A dynamic resource. Supply the product's id in the resourceId property.
  • url
    A static resource. Supply the URL to a file or external website address in the target property.

If you do you not know the resource and its resourceId, you can opt to supply the target URL only and Evance will automatically check for the correct settings.

resourceId
An unsigned 64-bit integer representing the ID of a dynamic resource. or null for static resources.
target
Either a path to a file, page, product, category or even an external website (absolute URL) to redirect the user to.
Required for static resources.
May be set to null for dynamic resources.


Example: redirect rule with a dynamic resource

A redirect rule for a dynamic resource such as page, category or product will have a target with a null value and a resourceId greater than zero, which identifies the resource object.

{
    "id": 3066,
    "resource": "page",
    "resourceId": 42309,
    "path": "/redirect-from",
    "target": null,
    "language": null,
    "country": null,
    "createdOn": "2019-11-09T01:02:00+00:00",
}

Example: redirect rule with a static resource

A redirect rule for a static resource (url) will have either an absolute URL or path in target and a resourceId of null.

{
    "id": 4842,
    "resource": "url",
    "resourceId": null,
    "path": "/redirect-external",
    "target": "https://www.example-store.com",
    "language": null,
    "country": null,
    "createdOn": "2019-11-09T01:02:00+00:00",
}