Fórumok

Changing friendly URL should keep track of the old one

thumbnail
Zsolt Balogh, módosítva 14 év-val korábban

Changing friendly URL should keep track of the old one

Expert Bejegyzések: 463 Csatlakozás dátuma: 2009.03.23. Legújabb bejegyzések
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, módosítva 14 év-val korábban

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

Liferay Legend Bejegyzések: 2034 Csatlakozás dátuma: 2009.03.05. Legújabb bejegyzések
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, módosítva 14 év-val korábban

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

Expert Bejegyzések: 463 Csatlakozás dátuma: 2009.03.23. Legújabb bejegyzések
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, módosítva 14 év-val korábban

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

Liferay Legend Bejegyzések: 2034 Csatlakozás dátuma: 2009.03.05. Legújabb bejegyzések
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, módosítva 14 év-val korábban

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

Liferay Legend Bejegyzések: 2871 Csatlakozás dátuma: 2006.08.31. Legújabb bejegyzések
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, módosítva 14 év-val korábban

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

Liferay Legend Bejegyzések: 2034 Csatlakozás dátuma: 2009.03.05. Legújabb bejegyzések
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, módosítva 9 év-val korábban

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

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
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, módosítva 9 év-val korábban

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

Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
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, módosítva 9 év-val korábban

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

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
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