Skip to content
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

Path rewriting does not work for the home page #940

Closed
ponjs opened this issue Mar 14, 2024 · 2 comments · Fixed by #1086
Closed

Path rewriting does not work for the home page #940

ponjs opened this issue Mar 14, 2024 · 2 comments · Fixed by #1086
Labels
bug Something isn't working contributions welcome Good for people looking to contribute

Comments

@ponjs
Copy link

ponjs commented Mar 14, 2024

Description

I'm rewriting /about as / but when I visit the / page, the url address bar is /about

20240314-171008.-.Compressed.with.FlexClip.mp4

Mandatory reproduction URL

https://stackblitz.com/edit/stackblitz-starters-nwjigc?file=src%2Fmiddleware.ts

Reproduction description

Visit stackblitz's open prview in new tab and visit / page

Expected behaviour

When the / page is accessed, the page is a /about page, but the url is still the / page.

@ponjs ponjs added bug Something isn't working unconfirmed Needs triage. labels Mar 14, 2024
@amannn
Copy link
Owner

amannn commented Mar 15, 2024

For the record, navigating to a locale root works as expected:

Screenshot 2024-03-15 at 10 42 34

So as far as I understand the issue, this is about the location that's picked when there's a locale-specific redirect at the root:

Screenshot 2024-03-15 at 10 43 12

As a workaround, you can consider adding your own redirect at the root in the middleware, but I think it would be helpful to investigate wether there's something to address here in next-intl.

@amannn amannn removed the unconfirmed Needs triage. label Mar 15, 2024
@amannn amannn added the contributions welcome Good for people looking to contribute label May 14, 2024
amannn added a commit that referenced this issue Jun 6, 2024
@amannn
Copy link
Owner

amannn commented Jun 6, 2024

I've refactored the middleware handling somewhat in #1086 and have added a test for your use case. Should work in the future after the PR is merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contributions welcome Good for people looking to contribute
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants