Forum Discussion

Anuj_Chaudhary_'s avatar
Anuj_Chaudhary_
Icon for Nimbostratus rankNimbostratus
Jul 06, 2016

Need help on redirection

Hi All,

 

Pls. help how we can redirect the below URL :

 

http:\oli2 application should redirect to http:\oli2.bcbsnj.com

 

Regards, AC

 

2 Replies

  • May be HTTP::host will help.

    Pseudocode

    if http host equals oli2
    redirect http://oli2.bcbsnj.com 
    
  • Assuming that you've solved the DNS part, and the fully-qualified domain names are really oli2 and oli2.bcbsnj.com, then, via an iRule:

    when HTTP_REQUEST {
        if { [string tolower [HTTP::host]] eq "oli2" } {
            HTTP::respond 301 Location "http://oli2.bcbsnj.com"
        }
    }
    

    If you only wish to redirect when the request is specifically for "/":

    when HTTP_REQUEST {
        if { [HTTP::path] eq "/" and [string tolower [HTTP::host]] eq "oli2" } {
            HTTP::respond 301 Location "http://oli2.bcbsnj.com/"
        }
    }
    

    If you are using 11.4 or higher, you may also use a Local Traffic Policy: