Forum Discussion

Krishna_R's avatar
Krishna_R
Icon for Nimbostratus rankNimbostratus
Apr 01, 2015

How to redirect url with extension?

Hi Team,

 

Could someone tell me what would be the iRule for url with extension to another url with extension.

 

Eg:

 

http://xxx.myhost.com/search?profile=NAP

 

to

 

http://xxx.myhost.com/search?profile=LL

 

Similarly,

 

http://yyy.corp.myhost.com/serach?profile=NAP

 

to

 

http://xxx.myhost.com/search?profile=LL

 

These are the two request. the first one is from one extension to other extension keeping the host as same (from NAP to LL). The second one is from a complete different host to another complete different host with different extension.

 

Please need help and appreciate help in advance!

 

2 Replies

  • Hi Krishna,

    This might work for you.

    when HTTP_REQUEST { 
       set http_host [string tolower [HTTP::host]]
       set uri [HTTP::uri]
       if { (($http_host  equals  "xxx.myhost.com") and ($uri equals "/search?profile=NAP"))  }{ 
          HTTP::redirect "http://xxx.myhost.com/search?profile=LL"
          return }
       elseif { (($http_host equals "yyy.myhost.com") and ($uri equals "/search?profile=NAP"))}{
          HTTP::redirect "http://xxx.myhost.com/search?profile=LL"
          return }
     }
    
  • Hi Stewart,

     

    Thank you so much for the iRule. I have wrote another one and it worked as expected. Appreciate your help in advance!

     

    Regards, Krishna