Forum Discussion

brownie6969_121's avatar
Icon for Nimbostratus rankNimbostratus
Jun 08, 2012

Simple iRule redirect but looking for cleanest way

Hey guys i am back, so the irules you helped me with worked just as I wanted and i was asked to do but the code doesn't work with it and they can't figure it out. They are investigating but in the meantime i will need to do exact link redirects. So i will have to do a couple of irules on the same virtual server. One that i already have and works with sends to now i have about 19 links that i will need to add a rule to on top of the one above. I need some help for this irule and what is the easiest way to get all 19 links in there. Examples are redirect to basically insted of doing the irule to add analytics in the middle i just need a basic irule to say if it comes across as link 1 redirect to link 2. Now i have about 20 just like that. Ideas for best way?

1 Reply

  • You can create a string data group with the source and target URIs to rewrite set as name=value pairs and then use the class command to perform the lookup. The iRule would look something like this assuming you name the data group uri_rewrite_dg.

    when HTTP_REQUEST {
    set uri [class match -value [HTTP::uri] equals uri_rewrite_dg]
    if {$uri ne ""}{
    HTTP::uri $uri