You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/pages/redirect.page.server.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ function onSomeHook() {
20
20
}
21
21
```
22
22
23
-
> `throw redirect()` makes temporary redirections (HTTP status code `302`). For permanent redirections (HTTP status code `301`) use <Linkhref="/redirects"noBreadcrumb={true} /> instead.
23
+
> `throw redirect()` makes temporary redirections (HTTP status code `302`). For permanent redirections (HTTP status code `301`), you can set <Linkhref="/redirects"noBreadcrumb={true} /> or pass a second argument `throw redirect('/some-url', 301)`.
24
24
25
25
While it's most commonly used with [`guard()`](/guard) or [`onBeforeRender()`](/onBeforeRender) you can use it with any hook.
Copy file name to clipboardexpand all lines: vite-plugin-ssr/shared/route/abort.ts
+6-11
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,9 @@ import {
28
28
}from'./utils.js'
29
29
importpcfrom'@brillout/picocolors'
30
30
31
-
typeRedirectStatusCode=301|302
31
+
typeRedirectStatusCode=number&
32
+
// For improved IntelliSense, we define the list of status code directly on redirect()'s argument type
33
+
Parameters<typeofredirect>[1]
32
34
typeAbortStatusCode=number&
33
35
// For improved IntelliSense, we define the list of status code directly on render()'s argument type
34
36
Parameters<typeofrender>[0]
@@ -44,22 +46,15 @@ type AbortRedirect = Error
44
46
*
45
47
* https://vite-plugin-ssr.com/redirect
46
48
*
47
-
* @param statusCode `301` (permanent) or `302` (temporary) redirection.
48
49
* @param url The URL to redirect to.
50
+
* @param statusCode By default a `302` (temporary) redirection is performed, but you can trigger a `301` (permanent) redirection instead. Alternatively, you can define permanent redirections by setting `config.redirects`, see https://vite-plugin-ssr.com/redirects.
0 commit comments