Skip to content

Commit

Permalink
docs: add next.config.ts code switcher to Redirecting docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JamBalaya56562 committed Dec 13, 2024
1 parent c2e7c89 commit d03ee97
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 d03ee97

Please sign in to comment.