IRule Redirect Appending URI to URL Not working

I need to create a simple iRule to redirect HTTP requests going to a URL (same as the HOST name) to the full URI. Basically appending the URI to the end of the URL. For example, here are the settings:

HOST= site.domain.com

URL= site.domain.com

URI= site.domain.com/OA_HTML/main.jsp

Full URI: https://site.domain.com/OA\_HTML/main.jsp

The iRule I created results in the page showing an error due to too many redirects.

when HTTP_REQUEST {

if { [HTTP::uri] contains “/”}

{ HTTP::redirect “https://site.domain.com/OA\_HTML/main.jsp” }

}

How can I make this work? Any help or suggestions is greatly appreciated!

,

Try below iRule. It should work as per your use case.

when HTTP_REQUEST {

HTTP::redirect “https://[getfield [HTTP::host] “:” 1]/OA_HTML/main.jsp”

}

Hope it helps!

Mayur