To redirect a user from the server-side or using the getServerSideProps() function in Next.js, you can use the redirect key with an object containing the destination property set to the path…
Next.js getServerSideProps()