留言板

Changing friendly URL should keep track of the old one

thumbnail
Zsolt Balogh,修改在14 年前。

Changing friendly URL should keep track of the old one

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
Hi,

I'm thinking about how could I keep track of the old friendly URL-s when I change it.

Our contractor is trying to change the page URL structure(SEO), but they want that the bookmarks of the users to work for a long time.

I had two ideas for this:
  • If you change the friendly URL of the page, it should automatically create a new, hidden child page of the page with the old URL. The page should be a redirect to the new one. This thing should be optional.
  • The pages should have more friendly URL-s and the editors just add a new one to the list. There should be a main URL of the page and the others should redirect to id.


What do you think?
thumbnail
Lisa Simpson,修改在14 年前。

RE: Changing friendly URL should keep track of the old one

Liferay Legend 帖子: 2034 加入日期: 09-3-5 最近的帖子
Wow, I can see your site map turning into an absolute nightmare. Typically what we do is that we front end Liferay with Apache. We use mod_proxy, so we can do stuff with regex URL matching to get people to the place they're going.
thumbnail
Zsolt Balogh,修改在14 年前。

RE: Changing friendly URL should keep track of the old one

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
Yes, it could cause interesting things, it it's not implemented correctly. Only the live links should be in the site map, the old ones would be just links to this.

The apache solution is not good for this, as the portal editors usually don't have access to the rewrite rules...
thumbnail
Lisa Simpson,修改在14 年前。

RE: Changing friendly URL should keep track of the old one

Liferay Legend 帖子: 2034 加入日期: 09-3-5 最近的帖子
I think one solution would be to have the link dialog have you point to a specific page (if it's on the web site) so that it would automagically update links if that gets moved or renamed.
thumbnail
Jorge Ferrer,修改在14 年前。

RE: Changing friendly URL should keep track of the old one

Liferay Legend 帖子: 2871 加入日期: 06-8-31 最近的帖子
Hi Zsolt, Lisa,

I've been thinking about how to support this feature in the past too. Most people do what Lisa described so I think one solution would be to automate it and make it independent of Apache. Actually Liferay already supports out of the box a URL rewritter through the filter URLRewriteFilter that is configured through an XML file.

My idea was to extend this filter so that instead (or besides) looking at the XML file it would look into a db. The db would have a table which maps URLs, with probably just two columns, (oldURL, newURL) plus some audit fields (userId, userName, date, ...). Then the UpdateLayoutAction (or LayoutLocalServiceImpl) would be modified so that if the friendly URL changes ant entry is added into the table. The final step would be a way to manage the redirects, and making sure they don't conflict with newer friendly URLs.

What do you guys think?
thumbnail
Lisa Simpson,修改在14 年前。

RE: Changing friendly URL should keep track of the old one

Liferay Legend 帖子: 2034 加入日期: 09-3-5 最近的帖子
Hmmm.... combine that with some monitoring so that you can see when the traffic starts to drop off as people's bookmarks, etc. get updated. Then you would know when to kill that redirect, which would then free that URL for reuse.
thumbnail
Thomas Berg,修改在9 年前。

RE: Changing friendly URL should keep track of the old one

Regular Member 帖子: 131 加入日期: 09-9-7 最近的帖子
Hi Zsolt!

I know this thread is very old but as I'm looking to accomplish the same thing, I have to ask if you implemented any of your ideas or found other solutions?

Thanks and regards

Thomas
thumbnail
Andew Jardine,修改在9 年前。

RE: Changing friendly URL should keep track of the old one

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

Defintiely an old thread, but I think Jorge's answer is the best and if you are using Liferay 6.1 or newer it would be very easy to achieve with --

1. Service Builder project to store the old/new urls.
2. A StrutsAction hook to change the logic of the UpdateLayoutAction
3. A Service hook for a Layout Wrapper

Have you worked with these concepts before?
thumbnail
Thomas Berg,修改在9 年前。

RE: Changing friendly URL should keep track of the old one

Regular Member 帖子: 131 加入日期: 09-9-7 最近的帖子
Hello Andew,
We're using Liferay 6.2. I'm familiar with those concepts but to be honest I was hoping that this had been implemented already so that I wouldn't have to emoticon

Thanks for the pointers!

Regards Thomas