Can we use the same friendly URL in a page's translations?
István Gergely-Tárnoki
更新
Issue
We have a page where we want to use the same friendly URL for different translations, but when we try to save the page, it fails with an error:
Please enter a unique friendly URL.
We understand that the behavior was made by design for SEO purposes, however, we would prefer to use our method, where we have the same URL with different locale prefixes, is that possible?
Environment
Liferay DXP 7.3+
Resolution
The behavior is intended, however, there is a workaround that might help you if you want to use the same friendly URL in your default language and one of the translations, or if you have a two-language environment. That means you won't be able to do this with two translations.
The trick is that if you leave a translation's friendly URL empty, it will be populated with the default language's friendly URL.
Please check the below steps (English was the site's default language in this case and we used the locale.prepend.friendly.url.style=2 property, where the language key was always displayed in the URL):
Create a page, name it Marketing-news (page name and friendly URL will be Marketing-news)
Add a German translation, name it German, and save without adding the friendly URL
Then switch to German either by setting it in the user's account settings or just changing the language key from en to de in the URL ->http://localhost:8080/de/marketing-news