Forum Discussion

TJ_Vreugdenhil's avatar
Dec 06, 2012

iRule to replace context root

Hi -

 

 

I would like to create an iRule that does some URI routing:

 

 

/myenrollments/* to /adminentrollments/*

 

So essentially, finding [HTTP:host]/myenrollments/{http_uri} and replacing it with [HTTP:host]/adminenrollments[HTTP:uri]

 

Does anyone have a sample iRule for this?

 

Thanks!

 

1 Reply

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Can you try this?

    
    when HTTP_REQUEST {
    
    if {[HTTP::uri] starts_with "/myenrollments"}{
    HTTP::uri [string map "/myenrollments /adminentrollments" [HTTP::uri]]
    }
    }
    

    Aaron