# remapping issue

**URL:** <https://community.f5.com/t/remapping-issue/22177>\
**Category:** Technical Forums\
**Tags:** big-ip, irules, application-delivery\
**Created:** [November 24, 2015, 8:56pm UTC](https://community.f5.com/t/remapping-issue/22177 "2015-11-24T20:56:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![numen\_235631](https://avatars.discourse-cdn.com/v4/letter/n/848f3c/32.png) [@numen\_235631](https://community.f5.com/u/numen_235631)\
**Post date:** [November 24, 2015, 8:56pm UTC](https://community.f5.com/t/remapping-issue/22177/1 "2015-11-24T20:56:01Z")

</div>

Hi,

I need some help with irule (or any other solution that will help) I have to make my URLs shorter so I’m doing below remapping

```tcl
`Code`
when HTTP_REQUEST {
HTTP::uri [string map -nocase {"/" "/xxxxx"} [HTTP::uri]]
}

```

Original link looks like that: [https://link.domain.com/xxxxx](https://link.domain.com/xxxxx) and after remapping [https://link.domain.com/](https://link.domain.com/)

It causing one problem – logo image located on this site disappear after remapping So this is effect of this remapping [https://link.domain.com/images/logo.png](https://link.domain.com/images/logo.png) but it should look like that [https://link.domain.com/xxxxx/images/logo.png](https://link.domain.com/xxxxx/images/logo.png)

how can I prevent it? of course i want to make my link shorter but i want to exclude such behavior.

---

<div class="post-metadata">

**Author:** ![VernonWells](https://avatars.discourse-cdn.com/v4/letter/v/dec6dc/32.png) [@VernonWells](https://community.f5.com/u/VernonWells)\
**Post date:** [November 24, 2015, 10:22pm UTC](https://community.f5.com/t/remapping-issue/22177/2 "2015-11-24T22:22:02Z")

</div>

The

```tcl
string map

```

substitutes every instance of / for /xxxxx. Thus, if the path-uri were /, it would change the path-uri to /xxxxx. If the path-uri were /foo/bar, it would change the path-uri to /xxxxxfoo/xxxxxbar. I believe what you are attempting to do is insert a path element at the start of any submitted path-uri, so that:

- if the user-agent requests _[http://link.domain.com/](http://link.domain.com/)_, the server sees _/xxxxx/_ as the request path-uri;
- if the user-agent requests _[http://link.domain.com/foo/bar](http://link.domain.com/foo/bar)_, the server sees _/xxxxx/foo/bar_ as the request path-uri;
- if the user-agent requests _[http://link.domain.com/images/logo.png](http://link.domain.com/images/logo.png)_, the server sees _/xxxxx/images/logo.png_ as the request path-uri.

Is that correct? If so, then you should be able to simply do this:

```tcl
when HTTP_REQUEST {
    HTTP::uri "/xxxxx[HTTP::uri]"
}

```

If you are using BIG-IP 11.4 or higher, you could also use a [Local Traffic Policy](https://support.f5.com/kb/en-us/solutions/public/15000/000/sol15085.html):

```tcl
ltm policy expand-path {
    controls { forwarding }
    requires { http }
    rules {
        rule01 {
            actions {
                0 {
                    http-uri
                    replace
                    path /xxxxx[HTTP::uri]
                }
            }
            ordinal 2
        }
    }
    strategy first-match
}

```

---

<div class="post-metadata">

**Author:** ![numen\_235631](https://avatars.discourse-cdn.com/v4/letter/n/848f3c/32.png) [@numen\_235631](https://community.f5.com/u/numen_235631)\
**Post date:** [November 25, 2015, 8:40pm UTC](https://community.f5.com/t/remapping-issue/22177/3 "2015-11-25T20:40:20Z")

</div>

thanks for you support!
