【问题标题】:Liferay shows different URL for different machinesLiferay 为不同的机器显示不同的 URL
【发布时间】:2012-10-10 08:37:50
【问题描述】:

我看到 Liferay 6.1 GA2 在不同的机器上生成了不同的 URL,即使我在浏览器中输入以下相同的 URL:

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

两台机器上的语言设置、本地设置、浏览器设置、控制面​​板设置等配置似乎相同。

谁能告诉我这是什么原因以及如何强制两台机器的浏览器呈现相同的 URL,例如 http://my.ip.0.202:8080/web/guest/home

谢谢

【问题讨论】:

  • 如果你调用第一台机器远程,清除缓存并调用第二台远程,你会得到相同的行为吗?
  • @MatthiasG 很抱歉,我无法理解您的问题,因为我是 Liferay 的新手,您能否详细解释一下您希望我做什么。谢谢
  • 你说你有两台机器。如果您使用第三台机器并以相同的方式访问它们,您会得到相同的结果/网址吗?

标签: url liferay liferay-6


【解决方案1】:

您是否查看过 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

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-14
    • 1970-01-01
    • 2014-03-21
    • 2012-09-07
    • 2023-02-08
    • 1970-01-01
    相关资源
    最近更新 更多