Forum Discussion

Stephen_Yip_879's avatar
Stephen_Yip_879
Icon for Nimbostratus rankNimbostratus
Nov 24, 2014

Help with iRule creation

Hi,

 

I needed to create an iRule to do the following,

 

Original URL

 

http://analytics2.jobshop.ca/InformationSystems/SER

 

Redirect to

 

http://analytics2.jobshop.ca/Reports/Pages/Reports/InformationSystems

 

However, I need all existing URLs to keep going to their existing destination, such as the following

 

http://analytics2.jobshop.ca/Reports/Pages/Report/HR/Tests

 

Any help with this is appreciated.

 

Thanks.

 

2 Replies

  • Stephen,

    Try this:

    when HTTP_REQUEST {
        if {[HTTP::path] starts_with "/InformationSystems/SER"} {
            HTTP::redirect "http://[HTTP::host]/Reports/Pages/Reports/InformationSystems/"
        }
    }
    
    • Brad_Parker's avatar
      Brad_Parker
      Icon for Cirrus rankCirrus
      I would tweak this to take out case sensitivity as technically urls should be all lower case and some web servers handle case differently. when HTTP_REQUEST { if {[string tolower [HTTP::host]] starts_with "/informationsystems/ser"} { HTTP::redirect "http://[HTTP::host]/Reports/Pages/Reports/InformationSystems/" } }