Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

sunitaBorn
Level 2
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
Dipti_Chauhan
Correct answer by
Community Advisor
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
ChitraMadan
Community Advisor
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? 
 
sunitaBorn
Level 2
Level 2
@Chitra , homepage is not static and it is dynamic. So it is something when a new page is available.
ChitraMadan
Community Advisor
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

 

vmadala
Level 3
Level 3

Hello @sunitaBorn ,

 

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

 

cq:redirectTarget: <redirect_page_path>

 

 

shelly-goel
Community Advisor
Community 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

Dipti_Chauhan
Correct answer by
Community Advisor
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