Forum Discussion
raytoles_75680
Nimbostratus
Nov 08, 2009Redirects for old site - iRule Newbie needs help
We have to support some redirects for old sites after our one of our new sites goes live. Our plan is the change our dns such the the old site request are sent to our new F5 virtual server. But I re...
The_Bhattman
Nimbostratus
Nov 08, 2009How about this
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] eq "oldsite.com" } {
switch -glob [HTTP::uri] {
"/" {
log local0. "redirect on empty URI"
HTTP::redirect "http://newsite.org/scrubs/imagine "
}
default {
set base [URI::basename [HTTP::uri]]
log local0. "This is the base variable $base"
set sbase [split $base .]
log local0. "this is the base split by the . : $sbase"
set itemn [lindex $sbase 0]
log local0. "redirect on itemnumber without the extension: $itemn"
HTTP::redirect "http://newsite.org/scrubs/imagine/$itemn.aspx"
}
}
}
}
This is also making an assumption that you will either have no URI or a uri with a valid . at the end of the URI.
CB
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