# URL Rewrite Help

**URL:** <https://community.f5.com/t/url-rewrite-help/72301>\
**Category:** Technical Forums\
**Tags:** application-delivery\
**Created:** [May 12, 2023, 11:46am UTC](https://community.f5.com/t/url-rewrite-help/72301 "2023-05-12T11:46:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qasim](https://avatars.discourse-cdn.com/v4/letter/q/45deac/32.png) [@Qasim](https://community.f5.com/u/Qasim)\
**Post date:** [May 12, 2023, 11:46am UTC](https://community.f5.com/t/url-rewrite-help/72301/1 "2023-05-12T11:46:13Z")

</div>

hi,

I am trying to write an IRULE for URL rewrite but and looked at the ones online but none seems to be working. The virtual server is set to "standard with default http profile and here is what I need:

[https://abc.com](https://abc.com) Actual URL  
[https://abc.com/ui/](https://abc.com/ui/) Re-written URL

[https://abc.com/](https://abc.com/) Actual URL  
[https://abc.com/ui/](https://abc.com/ui/) Re-written UR

[https://abc.com/ui](https://abc.com/ui) Actual URL  
[https://abc.com/ui/](https://abc.com/ui/) Re-written UR

[http://abc.com](http://abc.com) Actual URL  
[http://abc.com/ui/](http://abc.com/ui/) Re-written UR

[http://abc.com/](http://abc.com/) Actual URL  
[http://abc.com/ui/](http://abc.com/ui/) Re-written UR

[http://abc.com/ui](http://abc.com/ui) Actual URL  
[http://abc.com/ui/](http://abc.com/ui/) Re-written UR

any help will be highly appreciated.

thanks

---

<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:** [May 12, 2023, 12:05pm UTC](https://community.f5.com/t/url-rewrite-help/72301/2 "2023-05-12T12:05:07Z")

</div>

```tcl
when HTTP_REQUEST {
  if {[HTTP::path] eq "/"}{ HTTP::path "/ui/" }
}

```

---

<div class="post-metadata">

**Author:** ![Qasim](https://avatars.discourse-cdn.com/v4/letter/q/45deac/32.png) [@Qasim](https://community.f5.com/u/Qasim)\
**Post date:** [May 12, 2023, 12:11pm UTC](https://community.f5.com/t/url-rewrite-help/72301/3 "2023-05-12T12:11:44Z")

</div>

Hi,

I tried this but it doesnt seem to be working.

---

<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:** [May 12, 2023, 12:30pm UTC](https://community.f5.com/t/url-rewrite-help/72301/4 "2023-05-12T12:30:01Z")

</div>

@Qasim What is occurring when you make this change? What are you seeing on your tcpdump between the F5 and the client? You can try adding the following line to see what you see in the F5 logs.

```tcl
when HTTP_REQUEST {

    if {[HTTP::path] eq "/"}{
        HTTP::path "/ui/"
        log local0. "The HTTP Path is now [HTTP::path]" 
    }

}

```

---

<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:** [May 12, 2023, 1:08pm UTC](https://community.f5.com/t/url-rewrite-help/72301/5 "2023-05-12T13:08:16Z")

</div>

Are you running tests over HTTPS?&nbsp;  
Does your VS decrypt this traffic with ssl profiles?

---

<div class="post-metadata">

**Author:** ![Qasim](https://avatars.discourse-cdn.com/v4/letter/q/45deac/32.png) [@Qasim](https://community.f5.com/u/Qasim)\
**Post date:** [May 15, 2023, 7:32am UTC](https://community.f5.com/t/url-rewrite-help/72301/6 "2023-05-15T07:32:38Z")

</div>

Hi,

the backend servers have http and https both services running and&nbsp; VS has no SSL pofile so no decryption on F5.

thanks

---

<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:** [May 15, 2023, 2:04pm UTC](https://community.f5.com/t/url-rewrite-help/72301/7 "2023-05-15T14:04:26Z")

</div>

@Qasim If you are not performing SSL termination for this VS you will not be able to look at the HTTP header and manipulate it using iRules or traffic policies. If you must perform this function at the F5 then you will need to perform SSL termination.

---

<div class="post-metadata">

**Author:** ![Prasad4u](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@Prasad4u](https://community.f5.com/u/Prasad4u)\
**Post date:** [August 30, 2023, 2:11pm UTC](https://community.f5.com/t/url-rewrite-help/72301/8 "2023-08-30T14:11:20Z")

</div>

```tcl
if {[string tolower [HTTP::Host]] equals "abc.com" } {
    HTTP::header replace Host "abc.com"
    HTTP::uri "/ui/"
}

```

---

<div class="post-metadata">

**Author:** ![Prasad4u](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@Prasad4u](https://community.f5.com/u/Prasad4u)\
**Post date:** [August 30, 2023, 2:16pm UTC](https://community.f5.com/t/url-rewrite-help/72301/9 "2023-08-30T14:16:53Z")

</div>

```tcl
When HTTP_Request{
if {[string tolower [HTTP::Host]] starts_with "abc.com"} {
    HTTP::header replace Host "abc.com"
    HTTP::uri "/ui/"
}
}

```
