Forum Discussion

captaincroc's avatar
Icon for Nimbostratus rankNimbostratus
Jan 13, 2022

iRule assistance for subfolder redirect

Hi All,   iRule newbie here. I have a URL "" that I would like redirected to "".   I tried using the below iRul...
  • CA_Valli's avatar
    Jan 14, 2022


    in this attempt I'm using the getfield command to split URI by "/oldsubfolder/" string, so that first "oldsubfolder" match would be field 1 and the rest of your URI will be field 2.


    I'm replacing /oldsubfoler/ with new path manually and then appending the rest of your uri using field 2 syntax.


    when HTTP_REQUEST {
     if { [HTTP::uri] contains "/oldsubfolder/"} {
       HTTP::redirect https://[HTTP::host]/newsubfolder/[getfield [HTTP::path] "/oldsubfolder/" 2]

    I haven't had the chance to test this in a lab, please do before installing.