Liferay7:为 portlet 创建自定义 URL

Liferay7: Create custom URL for portlet

我需要在 LR7 中创建一个特定的 url,像这样:

www.portal.com/news.php

我想要这个是因为我需要提供与旧共享数据 (facebook) 的兼容性。

/news.php 将是我的自定义 portlet 的 portletURL。

提前致谢

路易斯

你可以URL重写配置urlrewrite.xml文件,位于WEB-INF文件夹:

该文件被 Liferay 中的 UrlRewriteFilter 使用,用您的 URLs 添加一个新规则:

<rule>
    <from>^/news.php</from>
    <to type="permanent-redirect">%{context-path}/your_new_url</to>
</rule>

有关 UrlRewriteFilter 语法的更多信息,请参阅:http://tuckey.org/urlrewrite/

如果您正在使用 Tomcat 应用程序服务器或者您有 Apache Httpd 网络服务器,您还可以在 Tomcat 网络服务器级别添加 url 重写规则,更多信息请参见: