Expand my Community achievements bar.

SOLVED

Redirection from XML response to external URL

Avatar

Level 4

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

Avatar

Correct answer by
Community Advisor

Hi @ariesyinn 

 

In your previous post I mentioned the same solution of adding the redirect at the dispatcher i.e. at your webserver end. Let's say end user is trying to access www.anything.com/whateverxmlpath.xml and I want them to redirect to https://www.anywhereyouwant.com then the below rules will work.

 

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

 

What is your request URL? Please provide the exact request URL that end user will be accessing and where you want the user to redirect i.e. the destination URL. I can provide the exact rule that you need to put on dispatcher and it will resolve the redirection issue.

 

Thanks! 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @ariesyinn 

 

In your previous post I mentioned the same solution of adding the redirect at the dispatcher i.e. at your webserver end. Let's say end user is trying to access www.anything.com/whateverxmlpath.xml and I want them to redirect to https://www.anywhereyouwant.com then the below rules will work.

 

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

 

What is your request URL? Please provide the exact request URL that end user will be accessing and where you want the user to redirect i.e. the destination URL. I can provide the exact rule that you need to put on dispatcher and it will resolve the redirection issue.

 

Thanks! 

Avatar

Level 4
I managed to solved it in client side by adding <xhtml:script xmlns:xhtml=http://www.w3.org/1999/xhtml src="<your file>.js" type="application/javascript"/>