Forum Discussion
Reg URL Redirection using IRule
Hi,
Is it possible to redirect a particular HTTP request to a particular URL based on the hostname and all other HTTP requests for that VIP to another URL using the following iRule.
when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "site.com" } { HTTP::redirect "https://yoursite1.com"; } else {HTTP::redirect "https://mysite09.com";}
}
Is it mandatory to use [string tolower ] when we are matching a [HTTP::host] Or can the iRule be written as
when HTTP_REQUEST { if { [HTTP::host] equals "site.com" } { HTTP::redirect "https://yoursite1.com"; } else {HTTP::redirect "https://mysite09.com";}
}
Thanks,
Yugandhar.
1 Reply
Yes, this is possible. The
function isn't mandatory, but it's probably better to use it so you will catch all upper- and lowercase variations of the hostname.string tolowerI see you use semicolons in your iRule. You don't need these.
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