redirect: (
status:
| 302
| 300
| 301
| 303
| 304
| 305
| 306
| 307
| 308
| {} & number,
location: string | URL,
) => never = SRedirect
Type Declaration
-
- (
status:
| 302
| 300
| 301
| 303
| 304
| 305
| 306
| 307
| 308
| {} & number,
location: string | URL,
): never
-
Parameters
- status: 302 | 300 | 301 | 303 | 304 | 305 | 306 | 307 | 308 | {} & number
- location: string | URL
Returns never
Redirect a request. When called during request handling, SvelteKit will return a redirect response. Make sure you're not catching the thrown redirect, which would prevent SvelteKit from handling it.
Most common status codes:
303 See Other: redirect as a GET request (often used after a form POST request)307 Temporary Redirect: redirect will keep the request method308 Permanent Redirect: redirect will keep the request method, SEO will be transferred to the new pageSee all redirect status codes