NextJS:Functions:redirect
리디렉션 기능을 사용하면 사용자를 다른 URL로 리디렉션할 수 있습니다. 리디렉션은 Server Components, Client Components, Route Handlers, Server Actions 에서 사용할 수 있습니다.
404로 리디렉션해야 하는 경우 대신 notFound 함수를 사용하십시오.
Example
import {redirect} from 'next/navigation';
export default async function RootPage() {
console.assert(false, 'Inaccessible section. Handled by middleware.');
redirect(`/your/url`);
}