• Resolved Jules Colle

    (@jules-colle)


    Hi, I was wondering if it’s possible somehow to keep the default language in the URL?

    My site is in English, and I have 2 translations: French and Dutch. So my homepage URL looks like this:

    • English: example.com/
    • French: example.com/fr/
    • Dutch: example.com/nl/

    What I would like is that the default language follows the same patterns as my translations. So: example.com/en/

    Also the other pages on the English website should look like this:

    • example.com/en/sample-page/
    • example.com/en/about/

    The reason we need this is because we have multiple websites with some automatic processes running in the background to set up websites and pull data from them. Being able to always rely on the language-part in the URL would greatly simplify our process. Also, we are migrating some websites from an older CMS system that was using this URL structure, so if we could keep our URLs the way they were before it would take away the need to create 301 redirects for all these pages.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Edson Galina Fortes

    (@glx77)

    Hi @jules-colle ,

    Thanks a lot for your message.
    I’m Edson and I’m glad to help you out. Actually, Weglot only proposes the language subdirectory “/xx”/ on the translated versions.
    As the integration is a subdirectory-based one, the translations are displayed in a subfolder of the root domain, i.e. your main domain. As we didn’t get this demand this much, and the way Weglot works with the translation generation, such a feature doesn’t seem really easy to implement on our end and so such a feature is not on our roadmap for now.

    Don’t hesitate to come back to us if you need more information.
    Have a great day,
    Regards,

    Thread Starter Jules Colle

    (@jules-colle)

    Thanks for your answer, Edson. Too bad that this isn’t possible out of the box. However, I’m willing to get my hands dirty with this one. Some paths I’m considering:

    • Change my site root to example.com/en/. But I’m afraid this will cause the translations to look like example.com/en/fr/ and example.com/en/nl/ is that correct?
    • Manipulate the .htaccess file or use a WP filter to rewrite all URLs that don’t start with /fr/ or /nl/ to /en/. If I manage to implement this, will Weglot still work fine, do you think?

    Thanks again for the support!

    Plugin Contributor Edson Galina Fortes

    (@glx77)

    Hi @jules-colle ,
    sorry for the late answer. I think it should be work with Weglot
    May you can process by step
    Step 1 : change your website root and check if it’s works even if you have strange url like /en/fr
    if it’s works, you can try manipulate your url with an htaccess rule. I’m just afraid it could create ‘too many redirection’ issue.
    Keep me in touch I’m interessting by this workaround ??

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Keep default language in URL’ is closed to new replies.