Forum Discussion

southern_shredd's avatar
Oct 17, 2022

redirect to to 301 location

We are trying to come up with an irule that will:

redirect based on id value X (eg. 144 string) to a new URL and append the same value in this new URL . So it must extract the id=X value and append it to the redirect URL 

 

Example:

https://value-same.domain.com/external/services/datastorage/#/?id=144"

 Must be redirected (301 location)

https://different-website.domain/external/services/datastorage/#/?id=144"

the value 144 could be any value. I was thinking of this 

I have tried a range of irules usind data groups but it has to get the value from the request

Does anybody have a suggestions? My irule below did not match anything but thats because of not hostname etc.

when HTTP_REQUEST {
if { [HTTP::uri] contains "/external/services/datastorage/#/?id=144"" }{
HTTP::respond 301 Location "https://different-website.domain/external/services/datastorage/#/?id=144""

}
}

 

  • CA_Valli's avatar
    CA_Valli
    Oct 18, 2022

    My bad, there's a typo.

    Edited in previous comment