Fórum

Portal redirects to last viewed page when viewing root URL

Joel Goguen, modificado 13 Anos atrás.

Portal redirects to last viewed page when viewing root URL

New Member Postagens: 10 Data de Entrada: 01/11/10 Postagens Recentes
I'm having trouble finding any information about redirecting users from the base URL. I have a Liferay 5.2 installation and I'm finding that if I view a public page as an unauthenticated user, then to to the base URL I'm automatically redirected to the last page I viewed. So say I view https://portal.domain/web/jgoguen/profile and then try to visit https://portal.domain/, I would be automatically redirected to https://portal.domain/web/jgoguen/profile again.

I can't seem to find anything relevant about this. Basically, I want all requests for the root URL to redirect to the login screen, and the portal can either display the login screen if they're unauthenticated or forward them if they're already authenticated. Pointers to documents I've missed or properties to investigate further would be greatly appreciated.
thumbnail
Jonas X. Yuan, modificado 13 Anos atrás.

RE: Portal redirects to last viewed page when viewing root URL

Liferay Master Postagens: 993 Data de Entrada: 27/04/07 Postagens Recentes
Hi Joel,

It should work as you expected.

Which Liferay version are you using? 5.2.3 CE or 6.0.5 CE?

Thanks

Jonas Yuan
==================
The Author of Liferay Books:
Liferay User Interface Development
Liferay Portal 6 Enterprise Intranets
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
Joel Goguen, modificado 13 Anos atrás.

RE: Portal redirects to last viewed page when viewing root URL

New Member Postagens: 10 Data de Entrada: 01/11/10 Postagens Recentes
I'm using 5.2.3 with Tomcat 6.
thumbnail
Minhchau Dang, modificado 13 Anos atrás.

RE: Portal redirects to last viewed page when viewing root URL

Liferay Master Postagens: 598 Data de Entrada: 22/10/07 Postagens Recentes
Joel Goguen:
I want all requests for the root URL to redirect to the login screen, and the portal can either display the login screen if they're unauthenticated or forward them if they're already authenticated.

If I understand what you're saying correctly, you want Liferay to behave in this way only on requests for "/". Namely, if a user were to request "/c", which is what Liferay redirects to after you request "/" and which is ultimately what causes the behavior you see, they should still get the last path behavior even if they are not authenticated.

If that's the case, the logic for what happens when you request "/" is handled by index.jsp and the easiest way to achieve what you describe would be to modify that file (either in the ext-web folder in an EXT environment or via a Liferay custom JSP hook) to always redirect to your login page for an unauthenticated user.
Joel Goguen, modificado 13 Anos atrás.

RE: Portal redirects to last viewed page when viewing root URL

New Member Postagens: 10 Data de Entrada: 01/11/10 Postagens Recentes
Thanks for the info, I was expecting a property of some sort. I'll take a look around index.jsp and see what I can do.
Joel Goguen, modificado 13 Anos atrás.

RE: Portal redirects to last viewed page when viewing root URL

New Member Postagens: 10 Data de Entrada: 01/11/10 Postagens Recentes
Thanks again for your help. I was able to edit ROOT/index.jsp to always redirect to our custom login page, which I chose to do by setting the value in the 'redirect' variable and commenting out the LayoutSet logic, and it works great.
thumbnail
Fuad Efendi, modificado 11 Anos atrás.

RE: Portal redirects to last viewed page when viewing root URL

Regular Member Postagens: 180 Data de Entrada: 05/04/07 Postagens Recentes
Joel Goguen:
I'm having trouble finding any information about redirecting users from the base URL. I have a Liferay 5.2 installation and I'm finding that if I view a public page as an unauthenticated user, then to to the base URL I'm automatically redirected to the last page I viewed. So say I view https://portal.domain/web/jgoguen/profile and then try to visit https://portal.domain/, I would be automatically redirected to https://portal.domain/web/jgoguen/profile again.

I can't seem to find anything relevant about this. Basically, I want all requests for the root URL to redirect to the login screen, and the portal can either display the login screen if they're unauthenticated or forward them if they're already authenticated. Pointers to documents I've missed or properties to investigate further would be greatly appreciated.



I had similar problem after migrating to Liferay 6.1.1-patched from GitHub, the problem which I never had during 7 years; after several hour of experimenting I found the fix for my www.tokenizer.ca (main portal site):

company.default.home.url=/web/www.tokenizer.ca


Thanks