Forum Discussion
Qamar_Zia_13515
Nimbostratus
Jun 01, 2014IRULE Help
Hi,
I need IRULE help to acheive the below requirement:
Request for (abc.gov.us) Redirect to (abc.us)
Request for ecouncil.us (abc.encouncil.us)
Appreciate if some one help me out at the earliest, need to acheive both redirections in the same IRULE.
Regards,
3 Replies
- The_Bhattman
Nimbostratus
Hi Qamar,
I think you are looking for something like the following:
when HTTP_REQUEST { if {[HTTP::uri] eq "/" } { switch -glob [string tolower [HTTP::host]] { "abc.gov.us" { HTTP::redirect "http://abc.us[HTTP::uri]" } "ecouncil.us" { HTTP::redirect "http://abc.encouncil.us[HTTP::uri]" } } } }I hope this helps,
-=Bhattman=-
Try this one:
when HTTP_REQUEST { set host [string tolower [HTTP::host]] switch $host { "abc.gov.us" { HTTP::respond 301 Location "http://abc.us" } "ecouncil.us" { HTTP::respond 301 Location "http://abc.ecouncil.us" } } }/Patrik
- nitass
Employee
e.g.
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { [HTTP::uri] eq "/" } { switch [HTTP::host] { "abc.gov.us" { HTTP::redirect "http://abc.us/" } "abc.encouncil.us" { do something" } default { do somethingelse } } } } } [root@ve11a:Active:In Sync] config curl -I http://172.28.24.10 -H "Host: abc.gov.us" HTTP/1.0 302 Found Location: http://abc.us/ Server: BigIP Connection: Keep-Alive Content-Length: 0
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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