Forum Discussion

JPV_131616's avatar
Dec 02, 2013

Irule uri redirect using regex?

Hi,

 

I need to do something like the following;

 

redirect /any/any/home/any to some.site.com

 

Where the uri's could be one of many pages using same pattern...

 

is there an easy way to do this using regex or something?

 

thx!

 

6 Replies

  • Richard__Harlan's avatar
    Richard__Harlan
    Historic F5 Account

    You could try contains "/home/". This should match on anything that contains the /home/ anyplace in the uri.

     

  • Hi JPV, with HTTP Classes, you can write something like that. From GUI, you can put //home/* in the "URI Paths" section of the HTTP Class, and select "Actions" redirect to, then put your URI in the "redirect to" section. You can also use Regex format for that in HTTP Classes, if you don't need "*" notation (regex instead of pattern).

     

    But this is valid with version 11.3 or before.

     

    in 11.4, LTM Policies (CPM) will not help because they don't support yet the regex notation. So you will then have to move into pure iRules with the regex command.

     

  • bsically I have a set of pages which contains languages, which is why i wanted a regex or something easy.

     

    I am on version 10.2 for this f5 pair.

     

    thx

     

  • okay, so in that case, and with version 10.2, i would go for HTTP Class, for better manageability and performance, than pure iRule.

     

    Anything i can help here ? Do you have a set of text with the regex/pattern you are trying to work with ?

     

  • Here is an example;

     

    http://some.site.com/en/ON/plans/index.shtml http://some.site.com/fr/ON/phones/index.shtml http://some.site.com/en/AB/plans/index.shtml http://some.site.com/fr/AB/phones/index.shtml http://some.site.com/en/BC/plans/index.shtml http://some.site.com/fr/BC/phones/index.shtml http://some.site.com/en/MB/plans/index.shtml http://some.site.com/fr/MB/phones/index.shtml http://some.site.com/en/NB/plans/index.shtml http://some.site.com/fr/NB/phones/index.shtml http://some.site.com/en/NL/plans/index.shtml http://some.site.com/fr/NL/phones/index.shtml http://some.site.com/en/NS/plans/index.shtml http://some.site.com/fr/NS/phones/index.shtml http://some.site.com/en/SK/plans/index.shtml http://some.site.com/fr/SK/phones/index.shtml http://some.site.com/en/PE/plans/index.shtml http://some.site.com/fr/PE/phones/index.shtml http://some.site.com/en/QC/plans/index.shtml http://some.site.com/fr/QC/phones/index.shtml

     

    basically it's language and provide variations.