Forum Discussion
Irule Query
1)Can we point multiple requests to multiple VIP by doing a redirection? Eg: http://home.xyz.com should still point to SharePoint 2010 server and when user hits •[http://home.xyz.com/Site1(should](http://home.xyz.com/Site1(should) be redirected to http://new-home.xyz.com/Site1) •http://home.xyz.com/Site1/SiteA (be redirected to http://new-home.xyz.com/Site1/SiteA) Basically I am looking at a wildcard redirection possibility like http://home.xyz.com/Site1* pointing to new SharePoint environment.
Irule proposed for this request:
when HTTP_REQUEST { if { ( [string tolower [HTTP::uri]] starts_with "/site1" ) } { HTTP::redirect "http://new-home.xyz.com/Site1"; } elseif {( [string tolower [HTTP::uri]] starts_with "/SiteA" ) } { HTTP::redirect "http://new-home.xyz.com/Site1/SiteA"; } }
- Andy_McGrathCumulonimbus
Using a switch statement in your HTTP_REQUEST event iRule would be best, something like this:
switch -glob [string tolower [HTTP::uri]] { "/site1*" { this will match on any string that starts with "/site1 HTTP::redirect https:://new.home.xyz.com[HTTP::uri] } "/sitea*" { this will match on any string that starts with "/site1 HTTP::redirect https:://new.home.xyz.com/Site1/[HTTP::uri] } }
For help on using switch statements in iRules see this helpful article iRule 101 Switch
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