Foros de discusión

Change Friendly URL for User Public Layout

thumbnail
Andrew Jardine, modificado hace 7 años.

Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey Guys --

I am working on a problem right now and I am a little stumped -- hoping maybe someone else has done this and solve it. I have a requirement to create a a user http://www.abc.com/${screenname}/profile. Every user would have one of these pages of course so I thought that the best option would be to use the User Public pages. I updated a few of the settings in my portal-ext like so --

## ---------------------------------------------------------------------
## Layouts
##
    #
    # Set whether or not private layouts are enabled. Set whether or not private
    # layouts should be auto created if a user has no private layouts. If
    # private layouts are not enabled, then the property
    # "layout.user.private.layouts.auto.create" is assumed to be false.
    #
    layout.user.private.layouts.enabled=false
    layout.user.private.layouts.auto.create=false

    #
    # Set whether or not public layouts are enabled. Set whether or not public
    # layouts should be auto created if a user has no public layouts. If public
    # layouts are not enabled, then the property
    # "layout.user.public.layouts.auto.create" is assumed to be false.
    #
    layout.user.public.layouts.enabled=true
    layout.user.public.layouts.auto.create=true


## ---------------------------------------------------------------------
## Default Public User Layout
##

    #
    # Set the name of the public layout.
    #
    default.user.public.layout.name=Profile

    #
    # Set the friendly url of the public layout.
    #
    default.user.public.layout.friendly.url=/profile


.. and that gives me the /profile, but by default however I have to use http://www.abc.com/web/andrewjardine/profile. Does anyone know if I can get rid of this? I'm hoping that I can as this is a site migration -- I don't really want to have to configure a 302 rule for it or write a service pre action if I can avoid it.
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
The /web is part of the "public" url stuff, when you define a vhost setting you can remove the /web from the result.
thumbnail
Andrew Jardine, modificado hace 7 años.

RE: Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David --

If you mean the virtual host for the public pages that is found in the site settings, I did get that in place. So when I go to www.abc.com it does go to the public home page without the /web/guest. But if I go to www.abc.com/andrewjardine/profile -- I get a page not found error.
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Gotcha. What version are we talking about here?
thumbnail
Andrew Jardine, modificado hace 7 años.

RE: Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Don't shame me ... 6.2 emoticon
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Check out the users.profile.friendly.url property, that's going to be the one you want...
thumbnail
Andrew Jardine, modificado hace 7 años.

RE: Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David,

I tried two settings for that property (with restarts of course) and validated in the Server Administrator area that they are being picked up. First I tried --

users.profile.friendly.url=/${liferay:screenName}/profile


and then on a wish, I tried ...

users.profile.friendly.url=${liferay:screenName}/profile


.. sadly, both result in the status not found -- the requested resource could not be found page. If I add /web though, then it comes back with the page. The rest of the (public) site is working fine though with the /web/guest nowhere to be found. Any other ideas? Is this perhaps a bug?
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
I wonder if it is tied to the default /web prefix for public pages., that the controller handling requests to /web has logic which tells it how to hand off to the profile page stuff.? Not sure, I'll try to dig into it a little more tonight Andrew...
thumbnail
Andrew Jardine, modificado hace 7 años.

RE: Change Friendly URL for User Public Layout

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David,

I think you're right -- I did a little digging last night as well and found the places where the user profile URL is generated (UserImpl) just to validate that the logic was paying attention to the setting. It all looks right. Would this be logic that is found in the FriendlyURLServlet?