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"
}
}