Try our conversational search powered by Generative AI!

Strict language routing introduced in Episerver 7 Patch 2

The routing has been changed so it is more strict for language handling. Let us say for example that there is a page under root named “News” in english and “Nyheter” in Swedish. Previously the URLs where handled as follows (given that no language mapping is defined for site hosts in config):

  • http://localhost/News/ (page in language given by context typically globalization setting in web.config, for example, en)
  • http://localhost/en/News/ (page in English)
  • http://localhost/sv/Nyheter/ (page in Swedish)
  • http://localhost/Nyheter/ (page in english since no language info in URL get language as in point 1)
  • http://localhost/en/Nyheter/ (page in english since language segment states English)

With the strict language routing the above URLs will be handled as follows:

  • http://localhost/News/ (404 since when not having language-host mapping in config language segment must be present)
  • http://localhost/en/News/ (page in English)
  • http://localhost/sv/Nyheter/ (page in Swedish)
  • http://localhost/Nyheter/ (404 as in point 1)
  • http://localhost/en/Nyheter/ (404 since language for a page with URL segment does not match the language segment)

Another change is that when a language to host mapping is defined, then a URL like http://localhost/en/News/ will give a 404 since when there is a host mapping that defines a language, then the language should not be present in the URL.

Note that there is a configuration setting strictLanguageRouting for the configuration element siteSettings that can be set to "false" to get a more tolerant behaviour.