404 Error when using i18n with subpath routing.
Answered
Diamond Master posted this in #help-forum
When i enable i18n in the next js configs, the site redirects me to mysite.eu/locale, but it throws a 404 page and console says it cannot find that url
Answered by Diamond Master
i tried a diff method for i18n and it worked without any problem, idk why the default nextjs one causes problems
49 Replies
@Diamond Master  Click to see attachment 
your project structure does not include a dynamic folder to receive the 
locale param. Make sure you add it, for example like that: (see attached)can you share your folder structure again?
Your middleware is not correctly configured. You need to move it to the same level as your 
app/ folder is (not inside)It's empty anyway for now
@Diamond Master  It's empty anyway for now 
What happens when you visit "/en/auth/login" ?
Gimme a min and i'll try
@Diamond Master  same error 
can you provide a repro, for example via github or https://codesandbox.io/ that shows only the error?
wdym only shows the error?
@Diamond Master  wdym only shows the error? 
that shows the error. I don't want to get your whole code and look through everything, so create a repro that contains only the files/code that is needed to reproduce the error
ok, gimme a min
only the files i am using
and that should reproduce the error
@Diamond Master  <@301376057326567425> https://github.com/Diamantino-Op/VoxelGamesWeb/tree/main 
Thanks for sharing! Are you it's the same as your current project? The dirs look different...
@B33fb0n3  Thanks for sharing! Are you it's the same as your current project? The dirs look different... 
backend is removed bc it should not used
or well, not rn
when you move the lang dir inside the app dir, then it works fine: https://codesandbox.io/p/github/Diamantino-Op/VoxelGamesWeb/csb-pfqmv5/draft/bold-dew
wtf
i did that and it didn't work anyway
oh wait, you took everything out of the (frontend) folder
@Diamond Master  oh wait, you took everything out of the (frontend) folder 
yea, I might moved something wrong lol. However it shows that the page is working with the dynamic locale param
@B33fb0n3  yea, I might moved something wrong lol. However it shows that the page is working with the dynamic locale param 
mine still doesn't work that way
@Diamond Master  why didn't it work for me 
Yea, your file structure need to be:
/app/[lang]/(frontend)/.../..Your error is currently not reproduceable for me. Either remove the backend folder or move it in the lang as well
i'll try to remove the backend
evem without backend still nothing
@Diamond Master  evem without backend still nothing 
it looks like your error is not reproducable for me. Provide a reproduction with the folder path 
/app/[lang]/(frontend)/.../.. and show, that it does not work with that folder structurewait why do you have en as the lang?
it should be en-US
@Diamond Master  wait why do you have en as the lang? 
en = language code for 
englishyeah, but i set it as en-US as default
@Diamond Master  yeah, but i set it as en-US as default 
yea, there shouldnt be any difference
i tried a diff method for i18n and it worked without any problem, idk why the default nextjs one causes problems
Answer
thx anyway!