Forum Discussion

Massimo_Ruscian's avatar
Massimo_Ruscian
Icon for Nimbostratus rankNimbostratus
Jun 11, 2018

iRule to redirect keeping part of URL

Hi, I need to do a redirect keeping part of URL. HOST: customer.it URI: /* --> /abc/* => customer.it/* becomes customer.it/abc/* /abc/* --> /abc/* => customer.it/abc/* remains customer.it/abc/* /xyz/* --> /xyz/* => customer.it/xyz/* remains customer.it/xyz/*

 

I tried to do this with an iRule without success. Someone could help me with this configuration?

 

Thanks!

 

1 Reply

  • Hi,

    tried this:

    when HTTP_REQUEST {
    
    set path [HTTP::path]
    
        if { !([HTTP::path] starts_with "/abc/" || [HTTP::path] starts_with "/xyz/") } {
            set  combinedpath "/abc$path"
            HTTP::redirect "$combinedpath"
        }
    }
    

    Keep me update.