I have an iRule that I have written that I think will do what I need it to do but would like someone to confirm this, or tell me what’s wrong. (Joe is just an example)
The first iRule would redirect you to “https://www.joe.com/net/myjoe” striping the “/content/index.html” off of the URL (this could be bad or confusing to the users).
am using the following iRule, it works for https but the else line doesn’t take the page back to http. Can anyone assist here? Am I using correct method? I want page to redirect back to http when user move away from /Contact-Us page.
when HTTP_REQUEST { if { [HTTP::host] equals “oaccac-pp.com” and [HTTP::uri] starts_with “/Contact-Us”} {HTTP::redirect “https://[HTTP::host][HTTP::uri]”} else {HTTP::redirect “http//[HTTP::host][HTTP::uri]”} }
Also, I wonder if the request away from Contact Us is in the same connection then you’d need oneconnect on the VIP. Hope I’m right on this…sure I’ll be corrected if not.
Remember that HTTP::redirect will create an HTTP 302 response (Moved Temporarily). If you ever need a permanent redirect for SEO reasons, use HTTP::respond 301 … instead.
Thank you Kevin, it worked. Now I have one more page /feedback and I tried this code but doesn’t work: HTTP VIP: when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with “/contact-us” } {HTTP::redirect “https://[HTTP::host][HTTP::uri]” } elseif { [string tolower [HTTP::uri]] starts_with “/feedback” } { HTTP::redirect “https://[HTTP::host][HTTP::uri]” } }
HTTPS VIP: when HTTP_REQUEST { if { not ( [string tolower [HTTP::uri]] starts_with “/contact-us” ) } {HTTP::redirect “http://[HTTP::host][HTTP::uri]” } elseif { [string tolower [HTTP::uri]] starts_with “/feedback” } { HTTP::redirect “http://[HTTP::host][HTTP::uri]” } } pl. assist.
Hi, Thanks so much for your response. I applied http and https rules you provided on each VS. when I click on /contact-us or /feedback, they are broken now. I tried accessing them directly by using URLs as well over http and https but same result - 404 just for those 2 pages. Anything else I can try?