我看到不同机器上的 Liferay 6.1 GA2 生成了不同的网址,即使我在浏览器中输入以下相同的网址:
http://my.ip.0.202:8080/
Machine-1的浏览器生成:
http://my.ip.0.202:8080/en_GB/web/guest/home
Machine-2的浏览器生成:
http://my.ip.0.202:8080/web/guest/home
两台机器上的配置,如语言设置,本地设置,浏览器设置,控制面板设置似乎都相同。
有人可以告诉我这个的原因吗?如何强制两台机器的浏览器呈现相同的网址,例如http://my.ip.0.202:8080/web/guest/home
由于
答案 0 :(得分:4)
你有没有检查过Liferay Wiki:Configure time zones and locale。
我没有尝试,但根据我的一位同事的说法:
这两台机器可能存在本地化不匹配问题。因此,对于一台机器,“en_GB”会自动附加到URL。
可以通过在portal-ext.properties
中设置属性来解决问题locale.prepend.friendly.url.style=0 (by default it is set to 1).
以下内容直接来自portal.properties
:
#
# Set this to 0 if the locale is not automatically prepended to a URL. This
# means that each URL could potentially point to many different languages.
# For example, the URL http://localhost:8080/web/guest/home could then be
# viewed by users in many different languages.
#
# Set this to 1 if the locale is automatically prepended to a URL when the
# requested locale is not the default locale. This means that each URL
# points to just one language. For example, the URL
# http://localhost:8080/web/guest/home would point to the default language.
# The URL http://localhost:8080/zh/web/guest/home and
# http://localhost:8080/zh_CN/web/guest/home would both point to the Chinese
# language.
#
# In cases where the prepended locale is "zh" and not complete locale
# "zh_CN", then the full locale returned will be based on the order in which
# the locales appear in the property "locales". If "zh_CN" appears before
# "zh_TW", then "zh" will be a short hand for "zh_TW".
#
# The default language is set in system.properties with the properties
# "user.country" and "user.language".
#
# Set this to 2 if the locale is automatically prepended to every URL. This
# means that each URL points to just one language.
#
# Note that each language requires an entry in the property "locales" and a
# servlet mapping in web.xml for the I18n Servlet.
#
locale.prepend.friendly.url.style=1
希望这有帮助。