Redirect URL with dynamic URI

Hello all,

i need some support by a redirect.

The problem is the following:

I want to redirect the URL with URI Path https://www.myurl.com/mypath

to

https://www.anotherurl.com/mypath.

I Only want to change the URL and the URI should be the same after the redirect.

Is it possible to do this by policies or do i need an iRule?

Thanks for your help!

Hello,

I don’t think it is possible to do it by policy (I don’t know if you can store variables with LTM policies)

But using an iRule you can do it for sure, try this :

when HTTP_REQUEST {
    if { [string tolower [HTTP::host]] eq "www.myurl.com" } {
        HTTP::redirect https://www.anotherurl.com[HTTP::uri]
    }
}

Please try it and give us a feedback

Regards