Forum Discussion
Pete_Paiva_7147
Jul 24, 2017Nimbostratus
iRule redirect based on hostname
Looking for some assistance in creating an iRule that would do the following:
User goes to http://one.abc.com/* redirect to http://one.xyz.com/sites/sync/SitePages/Home.aspx
However, if use...
- Jul 24, 2017
Try something like this:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "one.abc.com"}{ if {not (([string tolower [HTTP::path]] starts_with "/sites/hr") || ([string tolower [HTTP::path]] equals "/pages/aboutme.aspx"))}{ HTTP::redirect "http://one.xyz.com/sites/sync/SitePages/Home.aspx" } } }
https://devcentral.f5.com/wiki/iRules.HTTP.ashx
https://devcentral.f5.com/wiki/iRules.HTTP__host.ashx
Brad_Parker
Cirrus
Try something like this:
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] equals "one.abc.com"}{
if {not (([string tolower [HTTP::path]] starts_with "/sites/hr") || ([string tolower [HTTP::path]] equals "/pages/aboutme.aspx"))}{
HTTP::redirect "http://one.xyz.com/sites/sync/SitePages/Home.aspx"
}
}
}
https://devcentral.f5.com/wiki/iRules.HTTP.ashx
https://devcentral.f5.com/wiki/iRules.HTTP__host.ashx
Pete_Paiva_7147
Jul 25, 2017Nimbostratus
Brad - that worked, thanks so much for the help!!
Cory - I haven't done much with local traffic policies but I'll take a look at that for any future requests.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects