# IRule Redirect Appending URI to URL Not working

**URL:** <https://community.f5.com/t/irule-redirect-appending-uri-to-url-not-working/60378>\
**Category:** Technical Forums\
**Tags:** irules, big-ip, application-delivery\
**Created:** [June 17, 2020, 4:47pm UTC](https://community.f5.com/t/irule-redirect-appending-uri-to-url-not-working/60378 "2020-06-17T16:47:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rich\_L](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Rich\_L](https://community.f5.com/u/Rich_L)\
**Post date:** [June 17, 2020, 4:47pm UTC](https://community.f5.com/t/irule-redirect-appending-uri-to-url-not-working/60378/1 "2020-06-17T16:47:14Z")

</div>

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](http://site.domain.com)

URL= [site.domain.com](http://site.domain.com)

URI= [site.domain.com/OA](http://site.domain.com/OA)\_HTML/main.jsp

Full URI: [https://site.domain.com/OA\_HTML/main.jsp](https://site.domain.com/OA%5C_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](https://site.domain.com/OA%5C_HTML/main.jsp)” }

}

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

---

<div class="post-metadata">

**Author:** ![Mayur\_Sutare](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/mayur_sutare/32/5035_2.png) [@Mayur\_Sutare](https://community.f5.com/u/Mayur_Sutare)\
**Post date:** [June 18, 2020, 8:57am UTC](https://community.f5.com/t/irule-redirect-appending-uri-to-url-not-working/60378/2 "2020-06-18T08:57:25Z")

</div>

,

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
