Forum Discussion

smiley_dba_1116's avatar
smiley_dba_1116
Icon for Nimbostratus rankNimbostratus
Jun 07, 2010

Redirect help

Nobbie question. I need to create a iRule that does the following.

 

 

Initial request: www.tree.example.com

 

 

Redirect to: tree.example.com

 

 

I know this is simple, but sorta new.

 

 

Thanks.

 

 

ERS

 

2 Replies

  • Hi ERS,

    Here is an example

    
    when HTTP_REQUEST {
        if {([HTTP:host] eq "www.tree.example.com") and ([HTTP::uri] eq "/") } {
              HTTP::redirect "http://tree.example.com/"
           }
    }
    

    I hope this helps

    Bhattman
  • Alternatively, you can use a Local Traffic Policy:

    ltm policy tree-redirect {
        controls { forwarding }
        requires { http }
        rules {
            redirect {
                actions {
                    0 {
                        http-reply
                        redirect
                        location http://tree.example.com/
                    }
                }
                conditions {
                    0 {
                        http-host
                        values { www.tree.example.com }
                    }
                    1 {
                        http-uri
                        path
                        values { / }
                    }
                }
                ordinal 1
            }
        }
        strategy first-match
    }