author: laplante@plcb.ca category: GOWEB/HTTP date: 2024-03-18 title: “HTTP::REDIRECT Function”
http::redirect — Redirect to a new URL
http::redirect(url: string [, code: int])
The http::redirect function redirects the client to a specified URL.
By default, the redirection uses HTTP status code 302 Found unless
another status code is specified.
301 — Moved Permanently302 — Found (default)303 — See Other307 — Temporary Redirect308 — Permanent RedirectA predefined list of code is define in http::status.
// Redirect with default 302 status code
redirect("/new_url");
// Redirect with 301 Moved Permanently
redirect("/new_url", code: 301);