0

For SEO reason I need my site to always use language code in the URL. At the moment mysite.com/en/news is also accessible through mysite.com/news, according to my SEO contact, mysite.com/news should return content.

How do I achieve this behavior?

2
  • check this answer drupal.stackexchange.com/questions/19078/…
    – Bala
    Commented Sep 9, 2013 at 13:36
  • Thanks but that question is about "all the URL without language prefix show the Japanese pages". I do not want to use URLs with no language code. I always want to use language code. Therefor I having a hard time using the answer for my question.
    – dbd
    Commented Sep 9, 2013 at 13:50

3 Answers 3

3

Using the Global Redirect module with the default options. You can redirects all URLs without a language prefix to the correct URL with the default language prefix contained.

1
  • great minds.... Commented Sep 9, 2013 at 14:11
2

This is what you have (for example):

  • mysite.com (default)
  • mysite.com/fr (French)

This is what you are looking for (for example):

  • mysite.com/en (default)
  • mysite.com/fr (French)

This can be accomplished in your language settings. For each language you can set a Path prefix, use en and fr (for my example).

To redirect mysite.com to mysite.com/en you can use the Global Redirect module

0

In Drupal 8 you can go to Manage > Configuration > Regional and language > Languages > Detection and selection > URL (configure). Here you can add a prefix for the URLs for every language.

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.