Forum Discussion

Jayant_134932's avatar
Jayant_134932
Icon for Nimbostratus rankNimbostratus
Mar 24, 2016

How to append part of URI to redirected url in an iRule?

We recently moved from OHS to WLS for a runtime Apex environment. I am trying to setup a http::redirect rule. When a user types url "/pls/apex/f:p=1:1", it should be redirected to "/apex/f:p=1:1". I have tried http:uri, but it doesn't work. Is it possible to take part of the URI "/f:p=1:1" and append it to the redirected url?

 

1 Reply

  • If the first part of the path ("/pls") is always the same and always needs to be removed, you could try something like that in order to cut off the first 4 characters:

    when HTTP_REQUEST {      
      if { [HTTP::uri] starts_with "/pls/" } {
        newuri=[string range [HTTP::uri] 4 end]
        HTTP::redirect http://[getfield [HTTP::host] ":" 1]$newuri
      }
    }