Description Redirect requests to a new target.
Synopsis redirect: [ { status: code, from: "path", to: "path" }, ... ]
Example redirect: [ { status: 302, to: "https://" }, { status: 301, from: "/old", to: "/new.html" }, ],

The redirect property maps requests from one URI to a new URL.

The status argument may be either 301 for a permanent redirect or 302 for a temporary redirect. The default is 302.

The **from** property defines the leading URL portion that must match for the redirect. If the **from** property is omitted, it will match all URLs.

The **to** URL may be local to the system, in which case it will begin with a "/" character. Or it may be on another system, in which case it will begin with "http://" or "https://". In both cases, the user will receive a HTTP redirection response informing them of the new location of the document. If the **to** URL only consists of the scheme (https://), then the **from** URL will be used with the target scheme. This is useful to redirect all non-secure request to the secure https listening endpoint that supports TLS.

© Embedthis Software. All rights reserved.