Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

   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

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


   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"
share|improve this question

1 Answer 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?

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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