# rewrite help

**URL:** <https://community.f5.com/t/rewrite-help/33789>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [September 9, 2009, 8:51pm UTC](https://community.f5.com/t/rewrite-help/33789 "2009-09-09T20:51:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_Tebo\_7015](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Aaron\_Tebo\_7015](https://community.f5.com/u/Aaron_Tebo_7015)\
**Post date:** [September 9, 2009, 8:51pm UTC](https://community.f5.com/t/rewrite-help/33789/1 "2009-09-09T20:51:30Z")

</div>

Hello,

I have the following irule to rewrite a url

when HTTP\_REQUEST {

log local0. “[IP::client\_addr]:[TCP::client\_port]: Original URI: [HTTP::uri]”

log local0. “urlrewrite rule”

Check if URI matches first format using scan

if {[scan [HTTP::uri] {/%/app/download.php%(.\*)} a] == 1}

{

HTTP::uri “[http://www.myserver.com/tools/app/download/vendor/language/installer$a](http://www.myserver.com/tools/app/download/vendor/language/installer$a)”

}

}

===Log===

When I hit this rule i get the following error in my logs.

TCL error: urlrewritedownload HTTP\_REQUEST - bad scan conversion character p while executing scan [HTTP::uri] {/app/download.php.\*} a

The url I use to execute the irule is

[http://www.abc.com/app/download.php?id=1140000](http://www.abc.com/app/download.php?id=1140000)

Thanks,

Aaron

---

<div class="post-metadata">

**Author:** ![The\_Bhattman](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/the_bhattman/32/13958_2.png) [@The\_Bhattman](https://community.f5.com/u/The_Bhattman)\
**Post date:** [September 9, 2009, 9:16pm UTC](https://community.f5.com/t/rewrite-help/33789/2 "2009-09-09T21:16:33Z")

</div>

Are you trying to append **id=1140000** to the following redirect [http://www.myserver.com/tools/app/download/vendor/language/installer](http://www.myserver.com/tools/app/download/vendor/language/installer)? **id=1140000**?

if so then perhaps the following will work

```tcl
when HTTP_REQUEST {  
 log local0. "[IP::client_addr]:[TCP::client_port]: Original URI: [HTTP::uri]"  
 log local0. "Original Path: [HTTP::path]"  
 log local0. "Original Qeury: [HTTP::query]"  
 log local0. "urlrewrite rule"  
 if { ([HTTP::host] eq "www.myserver.com") and ([HTTP::path] eq "/app/download.php") } {  
 HTTP::redirect "http://[HTTP::host]/tools/app/download/vendor/language/installer?[HTTP::query]"  
 }  
 }

```

I hope this helps

CB
