Forum Discussion

lbong_53781's avatar
lbong_53781
Icon for Nimbostratus rankNimbostratus
Oct 24, 2008

URI insertion

Hi

 

 

I am trying to do the following and not sure how it can be done in iRule.

 

 

http://somehost.com/new?custid=12345 redirect to http://somehost.com/goto?id=345678&custid=12345

 

 

Basically the "custid=12345" is dynamic and the redirected url will have whatever "custid=12345" after the "&". The "goto?id=34567" will remain the same throughout.

 

 

http://somehost.com/new?custid=13456 redirect to http://somehost.com/goto?id=345678&custid=13456

 

http://somehost.com/new?custid=21364 redirect to http://somehost.com/goto?id=345678&custid=21364

 

 

Thanks.

 

 

--

 

LB

 

1 Reply

  • try this out:

     
     when HTTP_REQUEST { 
     if { not ([HTTP::uri] starts_with "/goto") } { 
     regsub {.+\?} [HTTP::uri] {/goto?id=345678\&} newUri 
     HTTP::redirect "$newUri" 
     } 
     }