Unverified Commit 43937799 authored by Jam Balaya's avatar Jam Balaya Committed by GitHub

docs: add `next.config.ts` code switcher to Redirecting docs (#73848)

Co-authored-by: 's avatarLee Robinson <me@leerob.io>
parent 484e5b1d
......@@ -237,7 +237,32 @@ The `redirects` option in the `next.config.js` file allows you to redirect an in
To use `redirects`, add the option to your `next.config.js` file:
```js filename="next.config.js"
```ts filename="next.config.ts" switcher
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
async redirects() {
return [
// Basic redirect
{
source: '/about',
destination: '/',
permanent: true,
},
// Wildcard path matching
{
source: '/blog/:slug',
destination: '/news/:slug',
permanent: true,
},
]
},
}
export default nextConfig
```
```js filename="next.config.js" switcher
module.exports = {
async redirects() {
return [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment