Help iRule Redirection to the same VIP

Hi All,

I have an URL abc.xxx.com that i wanted to redirect to abc.xxx.com/site/ when the user type the URL. I tried with the following URL. it just adds /infosell// many times and doesn’t work.

when HTTP_REQUEST {

if { [HTTP::host] equals “www.joe.com”} {

HTTP::redirect “https://[HTTP::host][HTTP::uri]/infosell/”

}

}

With the simple redirect rule below, i get redirect loop in the browser. I am a newbie to iRules

when HTTP_REQUEST {

HTTP::redirect “https://[HTTP::host]/infosell/”

}

Can anyone help?

Thank you for help

You can write something like this:

when HTTP_REQUEST {
  if { not ([HTTP::uri] starts_with "/infosell/") } {
    HTTP::redirect https://[HTTP::host]/infosell/
  }
}

I think what you’re looking for is something like:

when HTTP_REQUEST {
  if { ([HTTP::host] eq "www.joe.com") && !([HTTP::uri] starts_with "/infosell") } {
    HTTP::redirect "https://[HTTP::host]/infosell"
  }
}

That would redirect any request to joe.com that isn’t going to joe.com/infosell to that directory. If you need something else, let me know.

Colin