Class URLRedirectMgr

URLRedirect manager class. Methods in this class generate URLRedirects based on the current configuration for Static, Dynamic and URLRedirect mappings in Commerce Cloud Digital.

Information used to calculate URLRedirects are determined from the current HTTP request. The URL which is used to find a redirect can be accessed with getRedirectOrigin().

Property Summary 

PropertyDescription
redirect: URLRedirect (read-only)Returns an URLRedirect object, containing a location and status.
redirectOrigin: String (read-only)Returns the relative origin url (without protocol, port, hostname and site path information) which will be used in getRedirect() to calculate a redirect location for.

Constructor Summary 

This class does not have a constructor, so you cannot create it directly.

Method Summary 

MethodDescription
static getRedirect()Returns an URLRedirect object, containing a location and status.
static getRedirectOrigin()Returns the relative origin url (without protocol, port, hostname and site path information) which will be used in getRedirect() to calculate a redirect location for.

Methods inherited from class Object 

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Property Details 

redirect 

redirect: URLRedirect (read-only)

Returns an URLRedirect object, containing a location and status. The redirect is calculated based on origin url of current request and the configured Static, Dynamic and URLRedirect mappings for the requested site.


redirectOrigin 

redirectOrigin: String (read-only)

Returns the relative origin url (without protocol, port, hostname and site path information) which will be used in getRedirect() to calculate a redirect location for.


Method Details 

getRedirect() 

static getRedirect(): URLRedirect

Returns an URLRedirect object, containing a location and status. The redirect is calculated based on origin url of current request and the configured Static, Dynamic and URLRedirect mappings for the requested site.

Returns:

  • URLRedirect containing the location and status code, null in case of no redirect was found

getRedirectOrigin() 

static getRedirectOrigin(): String

Returns the relative origin url (without protocol, port, hostname and site path information) which will be used in getRedirect() to calculate a redirect location for.

Returns:

  • relative origin url

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!