Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

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

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

6 Replies

Avatar

Community Advisor

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? 
 

Avatar

Level 2
@Chitra , homepage is not static and it is dynamic. So it is something when a new page is available.

Avatar

Community Advisor

Hi @sunitaBorn,

Please refer to below article, it mentions various options for custom redirects - https://medium.com/tech-learnings/adobe-experience-manager-aem-implementing-custom-redirect-vanity-u...

Also, if this is something you want to test temporarily, you can achieve this through Target as well - 

https://experienceleague.adobe.com/docs/target/using/experiences/vec/redirect-offer.html?lang=en

 

Avatar

Level 4

Hello @sunitaBorn ,

 

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

 

cq:redirectTarget: <redirect_page_path>

 

 

Avatar

Employee Advisor

@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

Avatar

Correct answer by
Community Advisor

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