Skip to content

redirect

Triggers a navigation to url with the given HTTP status code. On an initial SSR response where the redirect can be detected before streaming begins, Houdini returns an HTTP 3xx response. On the client, or when the redirect occurs mid-stream, it triggers a router navigation.

function redirect(status: 300 | 301 | 302 | 303 | 307 | 308, url: string): never
import { redirect } from '$houdini'
if (!viewer) redirect(302, '/login')