Thanks to visit codestin.com
Credit goes to github.com

Skip to content

i18n breaks default routes for redirects/rewrites when locale: false #57616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
iDVB opened this issue Oct 27, 2023 · 2 comments
Closed
1 task done

i18n breaks default routes for redirects/rewrites when locale: false #57616

iDVB opened this issue Oct 27, 2023 · 2 comments
Labels
bug Issue was opened via the bug report template. Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation. stale The issue has not seen recent activity.

Comments

@iDVB
Copy link

iDVB commented Oct 27, 2023

Link to the code that reproduces this issue

https://github.com/iDVB/next.js/blob/i18n-rewrites

To Reproduce

  1. Run i18n-routing example on i18n-rewrites branch

rewrites tests
2. Browse to http://127.0.0.1:3000/rewriteWithLocale This WORKS
3. Browse to http://127.0.0.1:3000/fr/rewriteWithLocale This WORKS
4. Browse to http://127.0.0.1:3000/rewriteWithoutLocale This DOES NOT work (404)
5. Browse to http://127.0.0.1:3000/fr/rewriteWithoutLocale This DOES NOT work (404)

redirects tests
5. Browse to http://127.0.0.1:3000/redirectWithLocale This WORKS
6. Browse to http://127.0.0.1:3000/fr/redirectWithLocale This WORKS
7. Browse to http://127.0.0.1:3000/redirectWithoutLocale This DOES NOT work (404)
8. Browse to http://127.0.0.1:3000/fr/redirectWithoutLocale This DOES NOT work (404)

Current vs. Expected behavior

Current

Disabling locale for a redirect/rewrite completely breaks that route even for the default route.

Expected

Developers may want to disable locales for specific redirects/rewrites.
This should not disable those redirects/rewrites altogether, it should simply just disable the locale version of that route.

When disabled...

  redirects: async () => {
    return [
      {
        source: '/redirectWithoutLocale',
        destination: 'https://cnn.com/business',
        permanent: false,
        locale: false,
      },
    ]
  },

browsing here http://127.0.0.1:3000/redirectWithoutLocale should redirect to here https://cnn.com/business
and
browsing here http://127.0.0.1:3000/fr/redirectWithoutLocale should 404

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Github Codespaces
Binaries: 
  repo deps unchanged

Which area(s) are affected? (Select all that apply)

Routing (next/router, next/navigation, next/link)

Additional context

No response

@iDVB iDVB added the bug Issue was opened via the bug report template. label Oct 27, 2023
@github-actions github-actions bot added the Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation. label Oct 27, 2023
@nextjs-bot
Copy link
Collaborator

This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.

@nextjs-bot nextjs-bot added the stale The issue has not seen recent activity. label Apr 24, 2025
@nextjs-bot
Copy link
Collaborator

This issue has been automatically closed due to two years of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!

@nextjs-bot nextjs-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation. stale The issue has not seen recent activity.
Projects
None yet
Development

No branches or pull requests

2 participants