i18n subroutes and rewrites not working in dev
See original GitHub issueBug report
Describe the bug
When combining new i18n subroutes and rewrites in development mode the rewrite-paths does not work.
To Reproduce
- Clone and npm install: https://github.com/JohnPhoto/next-rewrites
npm run dev
- navigate to http://localhost:3000/hej or http://localhost:3000/sv/hej
- See the
404
(Now do the same after npm run build && npm run start
to see that the page(s) exist as expected)
To lazy to clone? boils down to this config:
module.exports = {
i18n: {
locales: ['en', 'sv'],
defaultLocale: 'sv',
},
async redirects() {
return [
{
source: `/_next/data/:deployment/hej.json`,
destination: `/_next/data/:deployment/sv/hello.json`,
permanent: true,
}
];
},
async rewrites() {
return [
{
source: '/hej',
destination: '/sv/hello',
}
];
},
};
Expected behavior
The page named /hello
should be shown for sv
locale.
System information
- OS: macOS
- Browser (if applies) chrome
- Version of Next.js: 10.0.0
- Version of Node.js: v12.19.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Next js rewrites not working for i18n routes - Stack Overflow
I'm having some issues with i18n rewrites in next js. Inside of my next.config.js I have the following /** @type {import('next').
Read more >Advanced Features: Internationalized Routing - Next.js
js has built-in support for internationalized (i18n) routing since v10.0.0 . You can provide a list of locales, the default locale, and domain-specific...
Read more >Create a nested navigation flow - Flutter documentation
Prepare for navigation; Display an app bar for the setup flow; Generate nested routes; Interactive example. Apps accumulate dozens and then hundreds of ......
Read more >IIS URL Rewriting and ASP.NET Routing - Microsoft Learn
When a Web client requests a URL that does not conform to the format that you want, the client is redirected to a...
Read more >The complete guide to internationalization in Next.js
In the past, creating multilingual applications was not an easy task, ... cuts through the noise to proactively resolve issues in your app ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, the rewrites + i18n support has been updated in the latest version of Next.js
v10.0.5-canary.3
with updated documentation available here https://nextjs.org/docs/api-reference/next.config.js/rewrites#rewrites-with-i18n-supportI’m going to close this since similar issues related to this have been resolved, if anyone is still encountering issues with this please provide an updated minimal reproduction and we can investigate further!
Sadly it did not help. (Updated example repo for “proof”).