Skip to main content

ctx.redirect

Perform a redirect to another action or an external URL in the user's current browser window.

// To another action
await ctx.redirect({ action: "edit_user", params: { id: user.id } });

// To an external URL
await ctx.redirect({ url: "https://example.com" });

Requires one of action or url to be specified.

params

Optional

Record<string, any>

Arbitrary key/value pairs to send as params to the redirected route.

route

Optional

string

Redirects to another route by its slug.

url

Optional

string

Redirects to the given URL.

Returns

null

Did this section clearly explain what you wanted to learn?