url - Liferay 对不同的机器显示不同的 URL

标签 url liferay liferay-6

即使我在浏览器中输入以下相同的 URL,我也会看到 Liferay 6.1 GA2 在不同的计算机上生成不同的 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

谢谢

最佳答案

您检查过 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

希望这有帮助。

关于url - Liferay 对不同的机器显示不同的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12815256/

相关文章:

java - Liferay 集成选项

java - Liferay 6.2 CE-GA6 使 NTLM 适用于 chrome 和 firefox?

java - Liferay Portlet 无法从 6.1 升级到 6.2

ruby-on-rails - Rails - 获取不带 GET 参数的当前 url

java - 我如何以编程方式使 Liferay Portlet 进入全屏模式

liferay - 如何在 Liferay 6.1 中为文档元数据字段类型添加额外的属性?

Java LDAP - 无法验证用户身份

url - 为什么 azure 的 CloudBlockBlob.Uri.AbsoluteUri 返回 HTTPS : for the blobls url?

url - 为什么有些网站分布在 www2、www3 子域,而有些网站却没有它来管理扩展?

url - 逃脱 | Wiki 标记模板中 URL 中的(垂直条/管道)