Returns a response with a status code of 301 (Moved Permanently) or 302 (Found) and instructs the router to redirect to the given URL.
The redirect()
function is used in the router()
, beforeRouter()
,
and afterRouter()
hooks to redirect to a page that is
not the requested page.
Optionally, you can pass a status code of "301"
or "302"
using the statusCode
parameter. If any other status code is passed or no status code is passed at all,
the status code defaults to "302"
.
The url to redirect to.
The status code to use.