掲示板

Change Friendly URL for User Public Layout

thumbnail
7年前 に Andrew Jardine によって更新されました。

Change Friendly URL for User Public Layout

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
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
7年前 に David H Nebinger によって更新されました。

RE: Change Friendly URL for User Public Layout

Liferay Legend 投稿: 14917 参加年月日: 06/09/02 最新の投稿
The /web is part of the "public" url stuff, when you define a vhost setting you can remove the /web from the result.
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: Change Friendly URL for User Public Layout

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
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
7年前 に David H Nebinger によって更新されました。

RE: Change Friendly URL for User Public Layout

Liferay Legend 投稿: 14917 参加年月日: 06/09/02 最新の投稿
Gotcha. What version are we talking about here?
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: Change Friendly URL for User Public Layout

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Don't shame me ... 6.2 emoticon
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: Change Friendly URL for User Public Layout

Liferay Legend 投稿: 14917 参加年月日: 06/09/02 最新の投稿
Check out the users.profile.friendly.url property, that's going to be the one you want...
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: Change Friendly URL for User Public Layout

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
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
7年前 に David H Nebinger によって更新されました。

RE: Change Friendly URL for User Public Layout

Liferay Legend 投稿: 14917 参加年月日: 06/09/02 最新の投稿
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
7年前 に Andrew Jardine によって更新されました。

RE: Change Friendly URL for User Public Layout

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
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?