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

redirection in xml

ariesyinn
Level 3
Level 3

Hi all,

I have a xml page. Instead of showing xml response, I want to redirect to external page.

How can I do auto redirection in .xml file?

ariesyinn_0-1624350987344.png

 

This is xml file

ariesyinn_0-1624355513192.png

 

I used JavaScript redirection code, but, i doesn't redirect and appears as shown below.

ariesyinn_1-1624355637931.png

 

 

 

 

Thanks.

 

1 Accepted Solution
Ritesh_M
Correct answer by
Community Advisor
Community Advisor

Hi @ariesyinn ,

The requirement is not clear. Do you have this as component in which you are showing XML response? Though, I will try to answer based on what I understood.

 

1. If the XML is coming via a component then you can simply create a Clientlib and write a jQuery on load event which can just redirect to another page. Add the Clientlib on your component HTML.

 

window.location.href = "http://www.w3schools.com";

 

2. You can also write a redirect on dispatcher using rules.

 

3. You can also create a page using  with sling:resourceType=foundation/components/redirect and configure the properties-

     Open page properties, and add the redirect url.

https://www.aemquickstart.in/2016/11/external-redirect-for-aem-page.html

 

Hope it helps!

View solution in original post

3 Replies
Ritesh_M
Correct answer by
Community Advisor
Community Advisor

Hi @ariesyinn ,

The requirement is not clear. Do you have this as component in which you are showing XML response? Though, I will try to answer based on what I understood.

 

1. If the XML is coming via a component then you can simply create a Clientlib and write a jQuery on load event which can just redirect to another page. Add the Clientlib on your component HTML.

 

window.location.href = "http://www.w3schools.com";

 

2. You can also write a redirect on dispatcher using rules.

 

3. You can also create a page using  with sling:resourceType=foundation/components/redirect and configure the properties-

     Open page properties, and add the redirect url.

https://www.aemquickstart.in/2016/11/external-redirect-for-aem-page.html

 

Hope it helps!

View solution in original post

ariesyinn
Level 3
Level 3
Hi @Ritesh_M, I accidently click as accepted. But, I haven't solved the issue yet. I have edited and provided more information. Please guide me.
asutosh_jena
Community Advisor
Community Advisor

Hi @ariesyinn 

You can handle the redirect at the webserver. Please add the below rule and it should take care of everything.

RewriteCond %{REQUEST_URI} ^/whatverxmlpath.xml$
RewriteRule (.*) https://www.anywhereyouwant.com [R=301,L]

Please ensure to put this rule in your dispatcher v-host file.

Thanks!