Forum Discussion

ibrahim_37929's avatar
ibrahim_37929
Icon for Nimbostratus rankNimbostratus
Jun 14, 2016

redirect i rule

Hi i want to redirect a lot of address like this format.

 

if http request comes with a.abc.com i want to redirect abc.com/a, b.abc.com ---> abc.com/b how can i do this with an i rule?

 

thanks for your help

 

5 Replies

  • Or you can use 2 data-groups and define use expressions to achieve your requirement with iRULE.

     

    • ibrahim_37929's avatar
      ibrahim_37929
      Icon for Nimbostratus rankNimbostratus
      i did not use data group because i have to write 80 address to Data group list.
  • when HTTP_REQUEST {
    set URI [lindex [split [HTTP::host] "." ] 0]
    HTTP::respond 301 Location https://[substr [HTTP::host] 2 ".com"].com/$URI
    }
    

    You should be able to make the above more efficient and workable.

  • Hi,

    You can use the below example. It's a single line irule :

    when HTTP_REQUEST {
        HTTP::respond 301 Location "https://[getfield [HTTP::host] "." 2][getfield [HTTP::host] "." 3]/[getfield [HTTP::host] "." 1]"
    }