next/link
with rewrites
works different in preview and local environment
#54963
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.
Link to the code that reproduces this issue or a replay of the bug
https://github.com/mrzmyr/link-to-rewrite-reproduction
To Reproduce
Localhost
https://localhost:3000/example
Preview
https://link-to-rewrite-reproduction-mrzmyr.vercel.app/example
Current vs. Expected behavior
Current
Given the
next.config.js
and a link
<Link href="/">Go Home</Link>
, the redirect on preview deployments sets the slug to["index"]
and to (the correct rewrite)["en"]
on local deployments.Expected
Given the
next.config.js
and a link
<Link href="/">Go Home</Link>
, the redirect on preview deployments sets the same slug["en"]
on local and preview deployments.Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:58 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6020 Binaries: Node: 19.9.0 npm: 9.6.3 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 13.4.20-canary.15 eslint-config-next: 13.4.19 react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Additional context
No response
The text was updated successfully, but these errors were encountered: