Forum Discussion
Alan_Evans_1020
Nimbostratus
May 24, 2011iRule to redirect to new name after given time
Our customer is going through a name change and we will need to redirect from oldname to newname starting on a given date. I realize I could just apply the iRule at the right time BUT why not automat...
hoolio
Cirrostratus
May 24, 2011Hi Alan,
The square braces act as backticks. Can you try this?
when RULE_INIT {
array set static::redirects {
app.example.com https://app.newexample.com/
www.example.com http://www.example.com/
}
Epoch time for 6/1/2011 00:00:00
set static::cutovertime 1306900800
}
when HTTP_REQUEST {
if { ([clock seconds] > $static::cutovertime) && ([info exists $static::redirects([string tolower [HTTP::host]])]) } {
log local0. "Redirecting to: $static::redirects([string tolower [HTTP::host]])"
HTTP::redirect $static::redirects([string tolower [HTTP::host]])
}
}
Aaron
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