Forum Discussion

Tim_E_299773's avatar
Tim_E_299773
Icon for Nimbostratus rankNimbostratus
Oct 12, 2017

Wildcard iRule or Policy redirect v13.0

Im trying to utilize a simple redirect policy or iRule so if someone enters mycompany.org/whatever, where "whatever" is a wildcard entry, it will redirect to https://mycompany.org/Target. I am not a coder by any means and not iRule savvy. The below redirect works if I type in mycompany.org/whatever. It will redirect to mycompany.org/Target but I cant figure out what to replace in the initial "if" line arguments to accomplish this.. thank you for your help.

 

when HTTP_REQUEST {

 

if {[HTTP::path] contains "/whatever"}{

 

log local0. "redirecting client [IP::client_addr]" HTTP::redirect "https://[HTTP::host]/Target"

 

}

 

}

 

1 Reply

  • Hi,

    The problem is what do you mean by whatever? Do you mean every uri but /target ?

    when HTTP_REQUEST {
        if {!([HTTP::path] starts_with "/Target")}{
            log local0. "redirecting client [IP::client_addr]"             
            HTTP::redirect "/Target"
        }
    }