Forum Discussion

b_seweryn_15157's avatar
b_seweryn_15157
Icon for Nimbostratus rankNimbostratus
Sep 15, 2017

Remap the context/path of the URL

hi All,

 

please help me with iRule that will remap my URL like that: from to

 

so basically i want to get rid if first folder from the URL.

 

Regards

 

1 Reply

  • Hello,

    If the /service_name/ is not changing, you can use the following command to do it

    when HTTP_REQUEST {
    
        if { [string tolower [HTTP::path]] starts_with "/service_name/" } {
                log local0. "Old path: [HTTP::path]"
                HTTP::path [string map -nocase { /service_name/ / } [HTTP::path] ]
                log local0. "New path: [HTTP::path]"
           }
    }
    

    Hope it helps

    Waiting for your feedback

    Regards