Introduction:
Currently when ever we are login in we are getting path like
http://localhost:8080/web/guest/home
First we will try to simplify this url
eg:
Suppose I made a community with name Fquad then I want to access
it as http://fquad.com rather than http://fquad.com:8080/web/guest/home
How to achieve it??
we need to follow few simple steps for it
Step 1: Go to c:\WINDoWS\System32\drivers\etc or search for host file
in host file add a line like this
127.0.0.1 www.fquad.com
Step 2: Stop the sever and start it and try to access the application with
url http://fquad:8080/web/guest/home , if working fine go to step 3
Step 3: Now create a community with name Fquad.
Step 4: Create 2 pages in Fquad community 1 public page and other private page.
Step 5: Go to manage pages of Fquad community click the setting tab and then click
the Virtual Host tab then you can see Public Virtual Host text field fill it with
www.fquad.com
Step 6: Now try to access application using url http://fquad:8080/
Step 7: To remove :8080 is simple just change connector port in tomcat/conf/server.xml
search for line Connector port="8080" protocol="HTTP/1.1 and change 8080 to 80 thats it.
Sometimes it is required to land directly to private page of a community then in portal-ext.properties
add 1 line , portal-ext.properties exist under tomcat\webapps\ROOT\WEB-INF\classes if not there create it
default.landing.page.path=/group/fquad
12 comments:
This is a good post knowledge to solve the problem,
Thanks
hi Ahmed..thnk for the post....
default.landing.page.path=/group/fquad if theri is only one community is theri its good if their are more than one ....how can we do that?
if we set this in the property file it will be open one communty from a user if the user does belong tothat community than he will get the erro....so please look into this and solve my problem
default.landing.page.path=/group/fquad ....hello Ahmed this is fine for the single community and if theri are multiple communities and multiple user and it happen that one user will be in one community and another in another then how can a single default page will work it out ....it will work out for the person who is theri in fqad but the person who is not theri ...so please look in to this and help me out.
thanks suresh
For multiple communities you need to modify CustomDefaultLandingPageAction
Thanks
KamalKant
please provide me the code if u have fro CustomDefaultLandingPageAction .
Hi Suresh and Anonymous,
You can solve the problem by modifying loginPostAction. For example check below code.
public class LoginPostAction2 extends LoginPostAction {
public void run(HttpServletRequest request, HttpServletResponse response)
throws ActionException {
try {
if (_log.isDebugEnabled()) {
_log.debug("Running " + request.getRemoteUser());
}
super.run(request,response);
long userId = PortalUtil.getUserId(request);
// checking user role
boolean isJournalist = NewsPermissionChecker.hasRole("Journalist", userId);
boolean isSubEditor = NewsPermissionChecker.hasRole("Sub Editor", userId);
String redirect = PortalUtil.getPathFriendlyURLPublic();
String current = PortalUtil.getCurrentURL(request);
// directing based on user role
if (isJournalist || isSeniorJournalist || isCitizenJournalist) {
redirect = redirect + "/guest/journalist-s-page";
} else if (isSubEditor) {
redirect = redirect + "/guest/sub-editor-s-page";
} else {
redirect = current;
}
response.sendRedirect(redirect);
}
catch (Exception e) {
throw new ActionException(e);
}
}
private static Log _log = LogFactoryUtil.getLog(LoginPostAction2.class);
}
In this I am directing based on user role , in that place get user's all community and direct him to desired community.
Hi kamalkant,
i'm trying to do that but i don't know where to put that file,
can you helpme?
Thanks for your post and any info
Hi Thomas ,
can you tell me regarding which file you are asking??
hi kamalkant, thanks for the quick answer.
the my problem is solved.
i was trying to make a redirect after login to the public page of the user, i find this block and see the code, but i'm new in liferay, i don't know where to put the LoginPostAction2 code. finaly i read a manual to make a hook to remplace the core functionality and use the code here to write my own,
Thanks
Hi,
Thanks for the information, but it does not work for me.
I'm trying to forward to a page after logging in, and I have specified the line
"default.landing.page.path=/web/guest/dashboard"
in my portal-ext.properties file. But, still it does not get redirected to the page. After logging in also, it remains in the same page.
Please help.
Thanks,
-ash
Hi,
I solved it myself by setting it in the below section.
Portal -> Settings -> General -> Navigation
Thanks,
-ash
Hello, I believe your site could be having browser compatibility issues.
When I take a look at your site in Safari, it looks fine but when opening in I.
E., it has some overlapping issues. I simply
wanted to give you a quick heads up! Besides that, great site!
my web page :: increase twitter followers
Post a Comment