No language redirect from `/` when using `nuxt generate` in `prefix` mode
See original GitHub issueThis bug is related to #677, where no redirect was generated in dev in spa
mode. It seems that in production mode, the same issue occurs.
Version
nuxt-i18n: 6.11.0 nuxt: 2.12.2
Reproduction Link
https://github.com/dokterbob/i18nuxt-redirect-bug
Steps to reproduce
- Clean nuxt project with
i18-nuxt
configured withstrategy
set to `prefix’ as per documentation (refer to reproduction link) and ‘mode’ set to ‘spa’ as per documentation - Generate a production build either with
npm run build
ornpm run generate
(identical results and inconsistent documentation for nuxt.js) - Statically serve
dist
folder, e.g.serve dist/
- Open
/
on server, e.g.http://localhost:5000/
whenserve dist/
is used.
What is Expected?
An index pages is loaded causing a redirect to a language prefix (e.g. /en/
or /pt/
).
What is actually happening?
No index file is present, depending on the webserver either a 404 is returned or a directory listing is generated.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5
Top Results From Across the Web
No language redirect from / when using nuxt generate in prefix ...
This bug is related to #677, where no redirect was generated in dev in spa mode. It seems that in production mode, the...
Read more >Redirect to locale with Nuxtjs and i18n on SPA mode
I got an idea to solve this problem but I did not know if it is the best solution. Just using .htaccess to...
Read more >Options - i18n-module
When using prefix_except_default strategy, URLs for locale specified here won't have a prefix. It's recommended to set this to some locale regardless of...
Read more >Rewrites - next.config.js
Rewrites act as a URL proxy and mask the destination path, making it appear the user hasn't changed their location on the site....
Read more >nuxt-i18n | Yarn - Package Manager
Integration with vue-i18n · Automatic routes generation and custom paths · Search Engine Optimization · Lazy-loading of translation messages · Redirection based on ......
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
I’d appreciate it if you could create a separate issue for this in this repo as it seems to be specific to the new full static mode. I need to find a way to detect it and apply same logic as for
generate
.Note that next version of Nuxt will do some command renaming again (deprecate the
export
command) so might be better to wait for that before taking a look.This issue is still happening, I’m using nginx and when I run
yarn generate
I’m getting no index.html in the output folder so nginx throws a 404. Any idea how to go about this?