Forum Discussion
Joe_105988
Nimbostratus
Mar 03, 2008Question on how to create a HTTP redirect rule
I am new to creating iRules and need to create one that redirects either of 2 urls (for both http or https) to one url (https).
Any help would be appreciated.
Thanks!
Nicolas_Menant
Employee
Mar 03, 2008You can use multiple when yes.
Otherwise to match multiple URIs you can use something like switch.
An extract from one of the link i sent you
when HTTP_REQUEST {
switch -glob [HTTP::URI] {
"/" { HTTP::redirect "https://[HTTP::host]/PortalWAR/appmanager/portal/home" }
"/blah/blah*" { HTTP::redirect "https://[HTTP::host]/[HTTP::uri]" }
"*blah" { HTTP::redirect "https://[HTTP::host]/[HTTP::uri]" }
"blah*" { HTTP::redirect "https://[HTTP::host]/[HTTP::uri]" }
"b?ah" { HTTP::redirect "https://[HTTP::host]/[HTTP::uri]" }
}
}
}
Here all those URI will be redirected to something else.
Here you have an example with some regexp.
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