Forum Discussion

Wil_Schultz_101's avatar
Wil_Schultz_101
Icon for Nimbostratus rankNimbostratus
Nov 30, 2006

Amature attempting a rewrite

So, I'm trying to rewrite a URL that looks like:

http://f5.my.com/find/3/2/1/some.jsp?whatever

to

http://f5.my.com/find/1/2/3/some.jsp?whatever

The following seems to work but is appears as if URL like below gets cut off.

http://f5.my.com/find/3/2/1/some.jsp?whatever/find/3/2/1/somethingelse.jsp


 elseif { $uri starts_with "/find/3/2/1" } {
  log local0.find
  set 1 [getfield $uri "/" 2]
  set 2 [getfield $uri "/" 3]
  set 3 [getfield $uri "/" 4]
  set 4 [getfield $uri "/" 5]
  set new [getfield $uri "$1/$2/$3/$4/" 2]
  redirect to http://f5.my.com/$1/$4/$3/$2/$new
 }

While this seems to work, in the interest of save future headaches is there a better was to rewrite a URL?
No RepliesBe the first to reply