From eb79218b7d214bd0d47d34f4316dd6f028ae5179 Mon Sep 17 00:00:00 2001 From: Lee Robinson Date: Mon, 1 Mar 2021 10:33:04 -0600 Subject: [PATCH] Add note about other redirects to `next.config.js` docs. (#22640) In case a user lands on this page via search or from Google, we should mention the other ways you can redirect with Next.js. --- docs/api-reference/next.config.js/redirects.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/api-reference/next.config.js/redirects.md b/docs/api-reference/next.config.js/redirects.md index ca85b9402f..3216d946af 100644 --- a/docs/api-reference/next.config.js/redirects.md +++ b/docs/api-reference/next.config.js/redirects.md @@ -165,3 +165,8 @@ module.exports = { ``` In some rare cases, you might need to assign a custom status code for older HTTP Clients to properly redirect. In these cases, you can use the `statusCode` property instead of the `permanent` property, but not both. Note: to ensure IE11 compatibility a `Refresh` header is automatically added for the 308 status code. + +## Other Redirects + +- Inside [API Routes](/docs/api-routes/response-helpers.md), you can use `res.redirect()`. +- Inside [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation) and [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering), you can redirect specific pages at request-time.