redirect(to:redirectType:)
Creates a redirecting Abort
error.
static func redirect(to location: String, redirectType: Redirect = .normal) -> Abort
Parameters
- location
The path to redirect to
- redirectType
The type of redirect to perform
Returns
An abort error that provides a redirect to the specified location
throw Abort.redirect(to: "https://vapor.codes")
Set type to ‘.permanently’ to allow caching to automatically redirect from browsers. Defaulting to non-permanent to prevent unexpected caching.