mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
If `config.i18n` exists with `defaultLocale` and there's a redirect that
looks like this:
```js
{
source: '/',
destination: '/destination',
permanent: false,
}
```
Then, if you access `/`:
- **Expected:** It redirects to `/destination`
- **Actual:** redirects to `/<defaultLocale>/destination`
This PR fixes it by adding a missing special-case logic for `/` in
`packages/next/src/lib/load-custom-routes.ts`.
x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1676271611253739)
## Bug
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
---------
Co-authored-by: JJ Kasper <[email protected]>
16 lines
235 B
JavaScript
16 lines
235 B
JavaScript
module.exports = {
|
|
i18n: {
|
|
locales: ['fr', 'en'],
|
|
defaultLocale: 'en',
|
|
},
|
|
async redirects() {
|
|
return [
|
|
{
|
|
source: '/',
|
|
destination: '/destination',
|
|
permanent: false,
|
|
},
|
|
]
|
|
},
|
|
}
|