How to redirect the index / after setting noPrefixDefaultLocale
See original GitHub issueHello, i have problem:
-
i set
noPrefixDefaultLocale
tofalse
in the description: By default, paths generated for the default language don’t contain a locale prefix, set this option to false to disable this behavior -
so the generated routes like this, good:
[
{
path: "/en/",
component: _3237362a,
name: "index-en"
},
{
path: "/fr/",
component: _3237362a,
name: "index-fr"
}
]
-
then when starting the app, do not redirect to
index
it shows404 page not found
error!!!http://localhost:port/
-> errorhttp://localhost:port/en
-> index page with English -
what i want is some
setting
that change the default language after settingnoPrefixDefaultLocale: false
or add another auto generated route like this of the default language:
[
{
path: "/",
component: _3237362a,
name: "index-en" // the default language!!! or redirectRootToLocale content!!
},
{
path: "/en/",
component: _3237362a,
name: "index-en"
},
{
path: "/fr/",
component: _3237362a,
name: "index-fr"
}
]
- i think this :
redirectRootToLocale: 'en'
must work every time. the problem as description said: Specify a locale to which the user should be redirected when visiting root URL (/), doesn’t do anything if noPrefixDefaultLocale is enabled
so make redirectRootToLocale
work every time to solve this as i think!!
and thank you 😃.
<div align="right">This question is available on Nuxt.js community (#c23)</div>Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:9
Top Results From Across the Web
How to redirect the index / after setting noPrefixDefaultLocale
Hello, i have problem: i set noPrefixDefaultLocale to false in the description: By default, paths generated for the default language don't ...
Read more >ruby on rails - redirect to index rather than show after save
while with a redirect the index function of the controller will run and then the view will be rendered from there. you are...
Read more >How can I redirect and rewrite my URLs with an .htaccess file?
Redirecting non-existing pages to index. If your index page isn't index. php, just change the last line to your actual index file.
Read more >How to Redirect a Web Page in HTML - W3docs
The simplest way to redirect to another URL is to use an HTML <meta> tag with the http-equiv parameter set to “refresh”. The...
Read more >How to Code a PHP Redirect - Bluehost.com
To setup, a simple redirect simply creates an index.php file in the directory you wish to redirect from with the following content:
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 have more things to make nuxt better, but I think this should implemented on nuxt core instead i18n, actually nuxt have a duplicated content problem on his routes too, for example:
/news/
and/news
both are valid and the same route, but for SEO it’s a big problem, should be more strict and generate only one mode, for example if it’s a folder generate only a/foldername/
and don’t allow access without final slash/foldername
(instead access make a 301 redirection to /foldername/ or show 404, both are valid for SEO) and for single vue files make only the/filename
as valid without the final slash.I gona try to learn about modules and try to send PR to you and nuxt to help with this things, I read the documentation on https://nuxtjs.org/api/configuration-modules but I still don’t know how I can debug the module startup, I tried to put some
console.log('test')
but don’t show anything on console.Thanks @MitsuhaKitsune, I like your approach and I’ll implement it asap 😃 I’m planning on refactoring the module’s code sometime to make it more scalable but I’m kinda waiting on Nuxt 2.0 to be released as it will bring better support for ES6 which should facilitate modules’ development.