# Help with irule

**URL:** <https://community.f5.com/t/help-with-irule/70717>\
**Category:** Technical Forums\
**Tags:** devops, application-delivery\
**Created:** [October 11, 2022, 8:31am UTC](https://community.f5.com/t/help-with-irule/70717 "2022-10-11T08:31:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gopalp](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gopalp](https://community.f5.com/u/gopalp)\
**Post date:** [October 11, 2022, 8:31am UTC](https://community.f5.com/t/help-with-irule/70717/1 "2022-10-11T08:31:15Z")

</div>

Hi,

Iam looking for help on irule setup for one of our application.athe requirement is to create an irule which renders contents of existing url with new domain.So basically we have an existing url [www.oldurl.com](http://www.oldurl.com) and when i click “products” in that page it will display list list of available products.The requirement is to setup a new url “[www.products.newurl.com](http://www.products.newurl.com)” which should render page of “[www.oldurl.com/products](http://www.oldurl.com/products)”.We are not looking for redirection but the page should render content of oldurl/products.Any help with irule is pretty much appreciated as we are stuck with this quite sometime.Thank you !

---

<div class="post-metadata">

**Author:** ![CA\_Valli](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CA\_Valli](https://community.f5.com/u/CA_Valli)\
**Post date:** [October 11, 2022, 8:53am UTC](https://community.f5.com/t/help-with-irule/70717/2 "2022-10-11T08:53:34Z")

</div>

Hello, try this out

```tcl
when HTTP_REQUEST {
  if {[string tolower [HTTP::host]] eq "www.products.newurl.com" }{
    HTTP::header replace Host "www.oldurl.com"
    HTTP::uri "/products"
  }
}

```

---

<div class="post-metadata">

**Author:** ![gopalp](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gopalp](https://community.f5.com/u/gopalp)\
**Post date:** [October 11, 2022, 3:38pm UTC](https://community.f5.com/t/help-with-irule/70717/3 "2022-10-11T15:38:29Z")

</div>

Hi, Thanks for the update.I implemented the irule but getting blank page without page details.It is not displaying anything except plain white page.

---

<div class="post-metadata">

**Author:** ![CA\_Valli](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CA\_Valli](https://community.f5.com/u/CA_Valli)\
**Post date:** [October 11, 2022, 4:25pm UTC](https://community.f5.com/t/help-with-irule/70717/4 "2022-10-11T16:25:36Z")

</div>

Hello, this code rewrites client request parameters before sending the traffic to the real server.

I’m assuming that there already was a configuration deployed for [oldurl.com](http://oldurl.com) which was working, and that [products.newurl.com](http://products.newurl.com) would be an alias that resolves to same VS IP -- please confirm.

If this is the case, you should see client requesting [products.newurl.com](http://products.newurl.com) , and request being rewritten before F5 sends it to real server in order to retrieve the desired content in a “transparent way” for client

 ![CA_Valli_2-1665505497976.png](https://d20hrnpixdzcsd.cloudfront.net/original/2X/f/fd96e496f084cc5a36af801b4f0eccdd75bfdf52.png)

---

<div class="post-metadata">

**Author:** ![gopalp](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gopalp](https://community.f5.com/u/gopalp)\
**Post date:** [October 11, 2022, 4:31pm UTC](https://community.f5.com/t/help-with-irule/70717/5 "2022-10-11T16:31:40Z")

</div>

Exactly !! That is what the current setup is [oldurl.com](http://oldurl.com) is already existing and&nbsp;[products.newurl.com](http://products.newurl.com) is an alias for same ip. So what do you suggest in order to make this working? Thank you

---

<div class="post-metadata">

**Author:** ![CA\_Valli](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CA\_Valli](https://community.f5.com/u/CA_Valli)\
**Post date:** [October 13, 2022, 1:21pm UTC](https://community.f5.com/t/help-with-irule/70717/6 "2022-10-13T13:21:43Z")

</div>

I would expect this to work, as per my last tests it is in my lab. Does the VS have http and (eventually) ssl profiles applied? This script requires them to parse traffic correctly.

---

<div class="post-metadata">

**Author:** ![gopalp](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gopalp](https://community.f5.com/u/gopalp)\
**Post date:** [October 17, 2022, 1:51pm UTC](https://community.f5.com/t/help-with-irule/70717/7 "2022-10-17T13:51:32Z")

</div>

Hi,

Yeah, we do have the profiles attached to the V-server and also certs configured.I will try creating a new certs and attach to the v-server as the current certs are have hostname as SAN.Thank you

---

<div class="post-metadata">

**Author:** ![Paulius](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/paulius/32/21698_2.png) [@Paulius](https://community.f5.com/u/Paulius)\
**Post date:** [November 2, 2022, 5:26am UTC](https://community.f5.com/t/help-with-irule/70717/8 "2022-11-02T05:26:08Z")

</div>

@gopalp if what @CA_Valli has provided is not working then most likely your server is not configured to respond to queries for [www.products.newurl.com](http://www.products.newurl.com) properly. You might consider verifying that the server is configured to process the HTTP request properly for the HTTP host and HTTP uri properly.
