Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

02-app > 02-api-reference > 04-functions > redirect.mdx #370

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/02-app/02-api-reference/04-functions/redirect.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: redirect
description: API Reference for the redirect function.
description: 리다이렉트 함수에 대한 API 렌퍼런스입니다.
---

The `redirect` function allows you to redirect the user to another URL. If you need to redirect to a 404, you can use the [`notFound` function](/docs/app/api-reference/functions/not-found).
`redirect` 함수는 사용자를 다른 URL로 리다이렉션 시킬 수 있습니다. 404페이지로 리다이렉션해야 하는 경우 [`notFound` 함수](/docs/app/api-reference/functions/not-found)를 사용할 수 있습니다.

## `redirect()`

Invoking the `redirect()` function throws a `NEXT_REDIRECT` error and terminates rendering of the route segment in which it was thrown. `redirect()` can be called with a relative or an absolute URL.
`redirect()` 함수를 호출하면 `NEXT_REDIRECT` 에러가 발생하고 에러가 발생한 경로 세그먼트의 렌더링이 종료됩니다. `redirect()` 함수는 상대 혹은 절대 경로를 사용하여 호출할 수 있습니다.

```jsx filename="app/team/[id]/page.js"
import { redirect } from 'next/navigation'
Expand All @@ -28,8 +28,8 @@ export default async function Profile({ params }) {
}
```

> **Good to know**: `redirect()` does not require you to use `return redirect()` due to using the TypeScript [`never`](https://www.typescriptlang.org/docs/handbook/2/functions.html#never) type.
> **참고**: `redirect()`는 타입스크립트의 [`never`](https://www.typescriptlang.org/docs/handbook/2/functions.html#never) 타입을 사용하기 때문에 `return redirect()`로 사용할 필요가 없습니다.

| Version | Changes |
| --------- | ---------------------- |
| `v13.0.0` | `notFound` introduced. |
| 버전 | 변경사항 |
| --------- | --------------- |
| `v13.0.0` | `notFound` 안내 |