http 301 redirect..HELP Please

Hello everyone,

I am new at iRules and i need to setup one pretty quickly. I appreciate any help.

I need to setup an iRule on one of my virtual server to do http 301 redirect.

lets say i need to redirect the traffic from www.test1.com to www.test1.new.com.

Is this rules correct?

when HTTP_REQUEST

{ HTTP::respond 301 “www.test1.new.com” “http://www.[HTTP::host][HTTP::uri]”

How about doing it in the following:

when HTTP_REQUEST {  
     if {[HTTP::host] eq "www.test1.com" } {  
       HTTP::redirect "http://www.test1.new.com"  
     }  
   }

Hope this helps

CB