6

I have a multilingual site configured to use path prefix for URL language detection.

When no prefix is used in the URL, the default language is assumed. How can I change this behavior?

I want the site to return content only when a language prefix is set in the URL, otherwise return a "page not found" error.

Reasoning behind this functionality:

  • Preventing duplicate content in search engines
  • Keeping everything well organized (under language prefixes)
  • Avoiding users to be able to view content without a language prefix and thus potentially link to it (loosing link juice)

Edit: added reasoning.

  • Mind explaning why you want that? – Letharion Apr 12 '12 at 10:38
  • The client wants it this way :) – ovi Apr 12 '12 at 11:22
  • Yeah, clients frequently wants magic to happen as well ;) This is just my personal opinion, but I don't consider that a very motivating reason to answer. – Letharion Apr 12 '12 at 11:37
  • I have to agree with you, my reasoning is not very motivating (even for me). Meantime the client has reconsidered this. Though, there are some good reasons why someone would want such functionality, which I will add to the question later. – ovi Apr 12 '12 at 16:01
4

You can configure it from (admin/config/regional/language/edit/en) if English language is the default and change (‏Path prefix language code) field from empty to en for example

  • 3
    I already use this, but I can still access the site without any prefix. I need the site to be accessible exclusively using a language prefix. – ovi Apr 12 '12 at 9:58
4

The solution I found was using the Global Redirect module with the default options. It redirects all URLs without a language prefix to the correct URL with the default language prefix contained.

-1

@ovi: Next to the language list tab, there is another tab - "Detection and selection". URL: admin/config/regional/language/configure Go to this page and enable detection method - URL. Save settings. It should work now. It worked for me without having additional modules.

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.