Skip to content

How to redirect the index / after setting noPrefixDefaultLocale #45

Closed
@NadhirBoukhenifra

Description

Hello,
i have problem:

  1. i set noPrefixDefaultLocale to false
    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

  2. so the generated routes like this, good:

[
  {
    path: "/en/",
    component: _3237362a,
    name: "index-en"
  },
  {
    path: "/fr/",
    component: _3237362a,
    name: "index-fr"
  }
]
  1. then when starting the app, do not redirect to index it shows 404 page not found error!!!
    http://localhost:port/ -> error
    http://localhost:port/en -> index page with English

  2. what i want is some setting that change the default language after setting noPrefixDefaultLocale: 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"
  }
]
  1. 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 :).

This question is available on Nuxt.js community (#c23)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions