Forum Discussion

Jeff_Nguyen_449's avatar
Jeff_Nguyen_449
Icon for Nimbostratus rankNimbostratus
Mar 21, 2014

inline irule redirect

i'm trying to do a irule redirect from one host header to another. User is moving site content from one site to another. But i want to make it inline so that, any folder/file within that path is redirect too. so anything after BMD, folder or file is redirect to that same path, instead of defaulting to BMD. Thanks for looking.

when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "abc.com" and [string tolower [HTTP::uri]] starts_with "/sites/pocc/bm/bmd"} {

  HTTP::redirect "https://xyz.com/sites/pocc/bm/BMD/" } 

}

5 Replies

  • Is this iRule not working the way you intend? Your syntax looks good.

     

  • it doesn't fit the desire need. I'm wanting everything under /BMD/ to be redirected. So if a user wants to hit /BMD/folder1/file.abc, it will send him there with the iRule. But in it current state, it send the users to /BMD/default.htm.

     

  • I see what you mean. Try this:

    when HTTP_REQUEST {
    if { [string tolower [HTTP::host]] equals "abc.com" and [string tolower [HTTP::uri]] starts_with "/sites/pocc/bm/bmd"} {
          HTTP::redirect "https://xyz.com[HTTP::uri]" } 
    }