# http 301 redirect..HELP Please

**URL:** <https://community.f5.com/t/http-301-redirect-help-please/41017>\
**Category:** Technical Forums\
**Tags:** irules, dev, devops, application-delivery\
**Created:** [August 13, 2009, 4:58pm UTC](https://community.f5.com/t/http-301-redirect-help-please/41017 "2009-08-13T16:58:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fazinfar\_29104](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fazinfar\_29104](https://community.f5.com/u/fazinfar_29104)\
**Post date:** [August 13, 2009, 4:58pm UTC](https://community.f5.com/t/http-301-redirect-help-please/41017/1 "2009-08-13T16:58:07Z")

</div>

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](http://www.test1.com) to [www.test1.new.com](http://www.test1.new.com).

Is this rules correct?

when HTTP\_REQUEST

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

---

<div class="post-metadata">

**Author:** ![The\_Bhattman](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/the_bhattman/32/13958_2.png) [@The\_Bhattman](https://community.f5.com/u/The_Bhattman)\
**Post date:** [August 13, 2009, 5:06pm UTC](https://community.f5.com/t/http-301-redirect-help-please/41017/2 "2009-08-13T17:06:25Z")

</div>

How about doing it in the following:

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

```

Hope this helps

CB
