3

I have a Drupal 8 site with two languages, Japanese (default language) and English.

By default, the default language pages are available at both / and /ja.

For example, /about and /ja/about both go to the Japanese "about" page.

I want to get Drupal to force the path prefix so that the URL is always shown as /ja/about and never just /about.

Interface text language detection settings

  • URL (path prefix, english: en, Japanese: ja)
  • Selected language (Japanese)

How can I do this?

For Drupal 7: see this question

1
  • The accepted answer of the linked question is still correct, only that Global Redirect is deprecated and you should use Redirect, see the module description.
    – 4uk4
    Commented Nov 8, 2017 at 14:10

3 Answers 3

4
  1. Select "English" as the default language and save
  2. Select "Japanese", again, as the default language and save

This way, you will force Drupal to prefix the URL's by the language id, even for the default language.

1
  • How is it even supposed to work? It doesn't seem to work on 8.9.3.
    – int_ua
    Commented Aug 13, 2020 at 21:42
6

Here the steps:

  1. Install Redirect module.
  2. Enable the module /admin/modules
  3. Go to admin page /admin/config/search/redirect/settings.
  4. Ensure Enforce clean and canonical URLs is checked.
0
2

Prefix - suffix configuration is moved to the URL language detections settings at Drupal 8 Please, use this path to edit suffixes for each language:

admin/config/regional/language/detection/url 

And dont forget to move up URL detection rule

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.