set page properties for Redirect to different home pages in AEM cloud | Community
Skip to main content
Level 2
Jun 29, 2021 3:23 PM UTC
Solved

set page properties for Redirect to different home pages in AEM cloud

Dear All,

 

I have below requirement to redirect my website to home pages and these home pages should be authorable for AEM cloud

 

For Example,

I have one site called www.sunita.com/en...So my requirement is if I will hit www.sunita.com/en then it will redirect to www.sunita.com/home.html
and next day when I will hit www.sunita.com/en it will redirect to www.sunita.com/home1.html and so on.

 

So that lets say the author creates
sunita.com/en/home.html
sunita.com/en/home1.html
sunita.com/en/home2.html

 

then on Monday I set the property in content/sunita/en page to be home.html but on Tuesday I decide to go live with the home1.html , so all I need to do is switch the property in the content/sunita/en page to point to home1.html

 

Can anybody put some lights how can I achieve this ?

 

Thanks,

Sonu

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Dipti_Chauhan
Dipti_ChauhanAccepted solution
New Participant
Jun 30, 2021 5:34 AM UTC

Hi @sunitaborn 

  For your scenario easiest solution would be to use redirectTarget property as it will give control to authors.However in this case redirect is handled by publishers so this enables additional traffic to publisher servers.

To avoid this you need to use Apache rewrite which will use AEM authored redirects. To achieve this one solution could be to maintain text file which contains all redirect url on dispatcher and you can update this file on page activation (same as VanityUrl's handling) or with help of scheduler.

 

And this is how you can use this text file in your rewrite rules

 

RewriteMap test "txt:/mnt/var/www/html/YOUR TXT FILE.txt"
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond ${test:%1} >""
RewriteRule ^(.*)$ ${test:$1} [R=302,L] 

 

Hope this helps.

 

Thanks

Dipti Chauhan

6 replies

Dipti_Chauhan
Dipti_ChauhanAccepted solution
New Participant
Jun 30, 2021 5:34 AM UTC

Hi @sunitaborn 

  For your scenario easiest solution would be to use redirectTarget property as it will give control to authors.However in this case redirect is handled by publishers so this enables additional traffic to publisher servers.

To avoid this you need to use Apache rewrite which will use AEM authored redirects. To achieve this one solution could be to maintain text file which contains all redirect url on dispatcher and you can update this file on page activation (same as VanityUrl's handling) or with help of scheduler.

 

And this is how you can use this text file in your rewrite rules

 

RewriteMap test "txt:/mnt/var/www/html/YOUR TXT FILE.txt"
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond ${test:%1} >""
RewriteRule ^(.*)$ ${test:$1} [R=302,L] 

 

Hope this helps.

 

Thanks

Dipti Chauhan

Translate
shelly-goel
Employee
Jun 30, 2021 4:50 AM UTC

@sunitaborn  You can achieve this with clientcontext personalization. You would day of the week as segment/ audience to configure a specific page on a specific day.

http://www.sgaemsolutions.com/2018/12/personalization-using-contexthub-in-aem.html

Other solution could be to leverage Redirect Map Manager

https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-map-manager/index.html

Translate
vmadala
Level 3
Jun 30, 2021 12:38 AM UTC

Hello @sunitaborn ,

 

We've cq:redirect property, you can add this property under jcr:content node for source page.

 

cq:redirectTarget: <redirect_page_path>

 

 

Translate
ChitraMadan
New Participant
Jun 29, 2021 10:40 PM UTC

Hi @sunitaborn ,

 

These type of redirects are typically handled in apache. Something like below

 

# resolve (/en) for home page
RewriteRule ^/${language}$ /content/sunita/home.html [PT,L]
OR
# resolve (/en) for home page
RewriteRule ^/${language}$ /content/sunita/home1.html [PT,L]
 
I do not completely understand as to when you want to switch between different homepages, is it something fixed like daily different home pages will take turns or is it something as and when a new page is available? 
 
Translate
Level 2
Jun 30, 2021 1:30 AM UTC
@8767815 , homepage is not static and it is dynamic. So it is something when a new page is available.
Translate