Forum Discussion
One VIP with two URLs redirecting to two URIs
Hi
I'm new with Irules so there's probably something small amiss here. I want the Irule to detect the difference between these two URLs and redirect it accordingly to the correct URL and URI.
smartit.xyz.com -> https://smartit.xyz.com/ux/smart-it// myit.xyz.com -> https://myit.xyz.com/ux/myitapp//
I also have a VIP on port 80 that redirects it to become HTTPS.
Any ideas ?
when HTTP_REQUEST { if { [HTTP::host] equals "smartit.xyz.com" and {[HTTP::uri] equals "/" }} { HTTP::redirect "https://smartit.xyz.com/ux/smart-it//" } if { [HTTP::host] equals "myit.xyz.com" and {[HTTP::uri] equals "/" }} { HTTP::redirect "https://myit.xyz.com/ux/myitapp//" }
}
Port 80 VIP
when HTTP_REQUEST { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
2 Replies
- StephanManthey
Nacreous
Hi Christian,
you can try the following, please:when HTTP_REQUEST { if { ([string tolower [HTTP::host]] equals "smartit.xyz.com") and ([HTTP::uri] equals "/") } { HTTP::redirect "https://smartit.xyz.com/ux/smart-it//" return } if { ([string tolower [HTTP::host]] equals "myit.xyz.com") and ([HTTP::uri] equals "/") } { HTTP::redirect "https://myit.xyz.com/ux/myitapp//" return } }Thanks, Stephan
- Christian_Greyl
Nimbostratus
Thanks you for the reply 😄 . Shortly after posting this I got it sorted by doing the following.
when HTTP_REQUEST { if { [HTTP::host] equals "smartit.xyz.com" and [HTTP::uri] equals "/" }{ HTTP::redirect "[https://smartit.xyz.com/ux/smart-it//](https://smartit.xyz.com/ux/smart-it//)" } if { [HTTP::host] equals "myit.xyz.com" and [HTTP::uri] equals "/" } { HTTP::redirect "[https://myit.xyz.com/ux/myitapp//](https://myit.xyz.com/ux/myitapp//)" } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com