I’m trying to follow the documentation page below to Use language prefixes for URLs
https://docs.kentico.com/display/K8/Configuring+URLs+for+multilingual+websites
I got a page with the alias “Home” that should be the default document for all the cultures.
three cultures are currently available:
- French (France) (Default)
- French (Belgium)
- Dutch (Belgium)
what i want to achieve is the following:
- [baseurl] -> redirect to [baseurl]/fr-fr/
- [baseurl]/fr-fr/ -> show just the page with “Home” alias
- [baseurl]/fr-be/ -> redirect to [baseurl]/fr-be/
- [baseurl]/nl-be/ -> redirect to [baseurl]/nl-be/
all of those should display the page with “Home” alias in the desired culture.
what I currently got instead is:
- [baseurl] -> redirect to [baseurl]/fr-fr/Home CORRECT, but with wrong url (“Home” should not be necessary)
- [baseurl]/fr-fr/ -> show just the page with “Home” alias CORRECT
- [baseurl]/fr-be/ -> show the page with “Home” alias with French (France) culture
- [baseurl]/nl-be/ -> show the page with “Home” alias with French (France) culture
basically, is ignoring the url-prefix.
MY SETUP
1) got a page under the root with alias “Home” (which should be default) localized with all 3 cultures
2) in Settings/Content in the section “Web site content”, “Default alias path” is set to “/Home”.
3) in Settings/Urls & Seo in the section “SEO – Cultures” the values are the following:
- Force domain culture: FALSE
- Use language prefix for URLs: TRUE
- Allow URLs without language prefixes: FALSE
Am I doing something wrong? do I need to setup the website differently in order to let this work as expected?
Thanks
ADDITONAL INFORMATION ABOUT THE BEHAVIOUR
additional test cases about the weird behaviour of the site:
- [baseurl]/home-fr -> redirects to /fr-be/home
- [baseurl]/home-nl -> redirects to /nl-be/home
both of these seems ok, BUT both are displaying (french France) culture
- [baseurl]/fr-be/home-fr showing correctly the french Belgian version
- [baseurl]/nl-be/home-nl showing correctly the dutch Belgian version.
the problem is that it should use just the url alias “home”, just like the normal fr-fr version. this alias is specified under the Url tab of the page:
CURRENT SETTING
Following you can find the page that I want to be default. Bear in mind that “Use custom URL path” was set to false, but for test purposed I turned that on, trying to associate /Home for all the cultures. Problem is that as soon as I save the path becomes “/Home-1”. I think this is because the default version of Home has already the Path “/Home”.
SETTINGS UNDER CONTENT
Bear in mind here that I tried to use a macro to choose “Default alias path” in a different way depending on the culture. It didn’t work as it didn’t process the macro at all (the site was redirected to the literal string of the macro)
SETTINGS UNDER URL & SEO
Here I tried to check the “Use name path for URL path” option, but still no luck. (tried [baseurl]/nl-be and still shows the fr-fr version of the Homepage)
4
Answers
ANSWER FROM KENTICO SUPPORT
steps that I took to solve the problem:
1) under Url and Seo/Default page : select "Use domain root"
2) for each culture of the homepage > "Page URL Path", check "Use custom url path" and set "Path or pattern" to empty string ("")
now everything works as expected.
[domainname]/ > correctly redirects to [domainname]/fr-fr showing fr-fr culture
[domainname]/fr-fr > correctly shows fr-fr culture homepage
[domainname]/fr-BE > correctly shows fr-BE culture homepage
[domainname]/nl-BE > correctly shows nl-BE culture homepage
You need to setup also in settings Urls and SEO > SEO – URLs > Default page as Use domain root
I’d suggest to go thru this article cultures demystified (for version 7, but the settings are still there) It’s possible you are forcing a visitor culture on the site (Sites application)/user (Users application) settings, also enable the kentico SQL debug and check which culture is retrieved (in general which SQL queries are executed) based on the where condition…this could be an indication of what’s going on…try also logging in as a different user and try different browsers (browsers have preferred language settings based on which kentico decides the displayed culture)
Make also sure you haven’t setup aliases / page paths on the home page for specific cultures.
I had the same problem, but I needed domain.com as main url for en-gb culture and for other domain.com/fr-fr and etc. And I couldn’t find out of box solution, so I developed a custom module which catches events when TreeNode element is updated or created, and I update DocumentUrlPath column of current node with value “/” +culture code (or alias if it exists) + “/” + Current Document Name.
And I check if the currect document is home page, I save it without document name.
Also I untick from checkbox “Use prefixes for URLs” in settings.
Now everything works perfect on my site.