留言板

How to customize liferay url format

thumbnail
Satish Babu Anupoju,修改在9 年前。

How to customize liferay url format

Junior Member 帖子: 79 加入日期: 11-2-20 最近的帖子
Hi Team

I am working on ecommorce implementation. Where I need to form URL like liferay url format fashion : "https://www.liferay.com/about-us/newsroom/in-the-news".


As per our requirement my target url format should be like : http://www.domainname.com/location/category/sub-category/title. (This is SEO friendly url format)


Can anyone advice me how to implement this


Regards
Satish Babu
thumbnail
Ravi Kumar Gupta,修改在9 年前。

RE: How to customize liferay url format

Liferay Legend 帖子: 1302 加入日期: 09-6-24 最近的帖子
What you need is Friendly URLs.
thumbnail
Satish Babu Anupoju,修改在9 年前。

RE: How to customize liferay url format

Junior Member 帖子: 79 加入日期: 11-2-20 最近的帖子
Hi Ravi


Thanks for sharing the link.

Got the output as mentioned in the article and getting the url format like : http://localhost:8080/web/guest/welcome/-/ems/action/getEmployee/employeeId/5?p_auth=3PFjIsW1

From the above url employeeId parameter formatted like employeeId/5 .

But as per my requirement I need to form the url pattern like : http://www.domainname.com/location/category/sub-category/title

Want to construct a url with only values ( no keys)


Please let me know if you need more clarity.

Regards
Satish Babu
thumbnail
Ravi Kumar Gupta,修改在9 年前。

RE: How to customize liferay url format

Liferay Legend 帖子: 1302 加入日期: 09-6-24 最近的帖子
Liferay friendly urls start with /-/...

Now, <pattern>/action/{actionName}/employeeId/{empId:\d+}</pattern> in friendly url route.xml can be played with.

Why not use
<pattern>/{actionName}/{empId:\d+}</pattern>

Or anything that suits you. I am not sure whether this will work fine, but you can try. emoticon
thumbnail
Sandip Patel,修改在9 年前。

RE: How to customize liferay url format

Regular Member 帖子: 205 加入日期: 11-1-5 最近的帖子
Hi,
As Ravi has mentioned Liferay freindly URL start with start with /-/... So URL before it must be there as it is Liferay site name and page name. But you can create own customize URL in routes.xml as <pattern>/{location}/{category}/{category}/{title}</pattern>.

Your URL looks like http://www.domainname.com/web/guest/welcome/{location}/{category}/{category}/{title}. This format can be supported in SEO as Liferay's all type of URL support SEO.
Syam Kumar,修改在8 年前。

RE: How to customize liferay url format

New Member 帖子: 8 加入日期: 11-12-9 最近的帖子
Hi Sandip

I am new to Liferay and I have same kind of requirement.

Could you please explain me how to include / write the required conditions in routes.xml

Regards
Syam Kumar
thumbnail
Andrew Jardine,修改在8 年前。

RE: How to customize liferay url format

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
Hi Syam,

There are a lot of really good examples out there on how to do some of this stuff. For example, Meera has provided a pretty thorough example on his blog: http://www.liferaysavvy.com/2014/06/liferay-friendly-url.html.

You don't actually need to specify all the implicit parameters for p_p_id, or plid etc anymore, just your own paramters that you want to make friendly. If you have a specific example that you need help with, feel free to post it here.