I've been trying to achieve this:

I have a multilingual site with 8 languages (en, fr, es, de, etc) and I want to make all those language available for all countries.

I want Drupal to understand that:

  • /en-CO alias of /en
  • /en-FR alias of /en
  • /es-US alias of /es
  • /es-AR alias of /es
  • /fr-CO alias of /fr
  • /de-US alias of /de

And so on... (They share the exact same content)

If I add all those custom languages is easy, but I don't want because more than 1600 combinations are posible.

Do you know if there is a way to achieve that programmatically or with a module ?

I'm currently looking into PathProcessor, but no result for now.

Any help would be greatly appreciated.

  • 2
    The question though is: Why? And if it wouldn't be better to have a proper hreflang setup in your HTML head. – leymannx Apr 2 at 6:35
  • I guess you already know that you can manually add aliases, but per page, at admin page: /admin/config/search/path – MilanG Apr 2 at 7:39

I achieved this using Persistent URLs: https://www.drupal.org/project/purl and a custom LanguageNegotiation plugin

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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