Forum Discussion

Joe_Pipitone's avatar
Joe_Pipitone
Icon for Nimbostratus rankNimbostratus
Jun 05, 2009

Simple redirect

I am trying to simply redirect one domain to another, but for some reason I am getting an error. The iRule looks like this:

 

 

when HTTP_REQUEST {

 

if { !([HTTP::host] "domain1.com") } {

 

HTTP::redirect "http://domain2.com"

 

}

 

}

 

 

The error I am getting is:

 

 

01070151:3: Rule [Redirect_test] error:

 

line 2: [parse error: PARSE syntax 44 {syntax error in expression " !([HTTP::host] "http://domain1.com") ": looking for close parenthesis}] [{ !([HTTP::host] "http://domain1.com") }]

 

 

I have a closing parenthesis, can anyone help?

1 Reply

  • I figured it out, the syntax was wrong:

     

     

    when HTTP_REQUEST {

     

    if { ([HTTP::host] eq "domain1.com") } {

     

    HTTP::redirect "http://domain2.com"

     

    }

     

    }

     

     

    that seems to work....