3

I have a load balancer F5 Big ip for my website. Currently, I am having 302 redirect in place; however, I wanted to apply 301 but dont know how.

For example:
My website (abc.com) when typed 302 redirects to abc.com/index and when typed www.abc.com 302 redirects www.abc.com/index. I wanted to have a rule which will help me in

  • abc.com - 301 redirect - www.abc.com/index
  • abc.com/index - 301 redirect - www.abc.com/index
  • www.abc.com - 301 redirect - www.abc.com/index

Below is the code that my tech person is trying:

Redirect to WWW

when HTTP_REQUEST {
   if { [HTTP::host] equals "abc.com" or [HTTP::host] equals "abc.co.in" or [HTTP::host] equals "www.abc.co.in" } {
      if {!( [HTTP::path] equals "/")} {
      HTTP::respond 301 Location "http://www.abc.com[HTTP::path]"
      }
    }
}

Redirect POST

when HTTP_REQUEST {
  if { [HTTP::method] equals "POST" } {
    persist source_addr
    pool shop_shop_vr4_http
  }
}

Redirect-VR4 HOMEPAGE

when HTTP_REQUEST {
   if { [HTTP::path] equals "/" or [HTTP::path] starts_with "/target/" or [HTTP::path] starts_with "/logs/" or [HTTP::path] starts_with "/config/" } {
      HTTP::redirect "http://[HTTP::host]/index.jsp.vr"
   }
}
1

Did you have a look at https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/13481/showtab/groupforums/Default.aspx for 301 irules?

  • I have added some more details in the question. Please check and lemme know if you can help on this – Kshah Aug 20 '12 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.