Forums de discussion

Redirect some pages to the same content

thumbnail
Pau Aza, modifié il y a 9 années.

Redirect some pages to the same content

New Member Publications: 4 Date d'inscription: 06/05/14 Publications récentes
Hi all!

I'm new to Liferay and I'm developing a site where I want to show the same layout except one portlet for different URL's. I'll explain myself:

I've got a country list and, for every country, I want to show the same page but with different information.

In PHP and Java I can do www.myweb.com?country=france and I've got the parameter, but I want to do that this way: www.myweb.com/france

Is there any way I can achieve this without creating a page for every country? Because I have 20 - 30 countries and I wouldn't want to create 20 - 30 nearly equal pages.

Thanks in advance!! ^^
thumbnail
Manali Lalaji, modifié il y a 9 années.

RE: Redirect some pages to the same content

Expert Publications: 362 Date d'inscription: 09/03/10 Publications récentes
Hi Pau,

As far as I understand your requirement, You can try following:

1. Create a page CountryInfo
2. Put your portlet on the page
3. In your portlet's render method, try to fetch Url parameter

          HttpServletRequest convertReq = PortalUtil.getHttpServletRequest(portletRequest);
	  HttpServletRequest originalReq = PortalUtil.getOriginalServletRequest(convertReq);
	  String countryName= originalReq.getParameter("country");
           if(countryName.equalsIgnoreCase('France')){
               //Perform operation                  
           }else if(){
           }else{  // Default info
          }


You can also refer link

HTH!
thumbnail
Pau Aza, modifié il y a 9 années.

RE: Redirect some pages to the same content

New Member Publications: 4 Date d'inscription: 06/05/14 Publications récentes
Thanks a lot Manali, that is nearly the soution I'm looking for, but I might have explained myself wrong.

What I want to achieve is that I want to access to the same page even if I enter some different countries:

www.myweb.com/france
www.myweb.com/spain
www.myweb.com/portugal
...

Is there any way I can access all those URL and passing through the same Liferay page but changing the portlet's content?
thumbnail
Subhash Pavuskar, modifié il y a 9 années.

RE: Redirect some pages to the same content

Regular Member Publications: 234 Date d'inscription: 13/03/12 Publications récentes
Hi,

Your question still not clear !! well as i understood by above i found like this
Create the Page Country instead of france,spain,portugal and you can pass the content dynamically .
Sorry if i am wrong or you can provide an clear example for the same.
thumbnail
Pau Aza, modifié il y a 9 années.

RE: Redirect some pages to the same content

New Member Publications: 4 Date d'inscription: 06/05/14 Publications récentes
You were right, it is exactly what am I pretending to implement, but I don't know if it is possible to achieve that.
thumbnail
Subhash Pavuskar, modifié il y a 9 années.

RE: Redirect some pages to the same content

Regular Member Publications: 234 Date d'inscription: 13/03/12 Publications récentes
Why it not possible !! What information you want to display whether of type WebContent Display or custom Porlet etc..?
thumbnail
Pau Aza, modifié il y a 9 années.

RE: Redirect some pages to the same content (Réponse)

New Member Publications: 4 Date d'inscription: 06/05/14 Publications récentes
I've found a solution to my problem!

After days of searching I've found that, with a hook, I can achieve what I was pretending to do.

With my hook I can see when I'm trying to enter to a concrete country and then I redirect to a general page where I have a portlet that displays the information of that concrete country.

Many thanks to all for your help!! ^^

Pau