Skip to content

Commit

Permalink
docs: add next.config.ts code switcher to Redirecting docs (vercel#…
Browse files Browse the repository at this point in the history
…73848)


Co-authored-by: Lee Robinson <[email protected]>
  • Loading branch information
JamBalaya56562 and leerob authored Dec 15, 2024
1 parent 484e5b1 commit 4393779
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit 4393779

Please sign in to comment.