rsnext/test/integration/custom-routes-i18n-index-redirect
Shu Uesugi 2443c7155b
Fix redirect for the root path with i18n and defaultLocale (#45847)
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 <jj@jjsweb.site>
2023-02-13 12:27:28 -08:00
..
pages Fix redirect for the root path with i18n and defaultLocale (#45847) 2023-02-13 12:27:28 -08:00
test Fix redirect for the root path with i18n and defaultLocale (#45847) 2023-02-13 12:27:28 -08:00
next.config.js Fix redirect for the root path with i18n and defaultLocale (#45847) 2023-02-13 12:27:28 -08:00