Forum Discussion
Alan_Evans_1020
May 24, 2011Nimbostratus
Thank you Aaron for steering me in the right direction. I did discover one more thing. The 'info exists $static::' needs to be 'info exists static::' as is the whole problem here I don't understand TCL syntax to know why...
Here is the final result:
when RULE_INIT {
array set static::renameredirects {
app.example.com https://app.newexample.com
www.example.com http://www.newexample.com
}
Epoch time for 6/1/2011 00:00:00 EST
set static::renamecutovertime 1306900800
}
when HTTP_REQUEST {
if { ([clock seconds] > $static::renamecutovertime) && ([info exists static::renameredirects([string tolower [HTTP::host]])]) } {
log local0. "Redirecting to: $static::renameredirects([string tolower [HTTP::host]])[HTTP::uri]"
HTTP::redirect $static::renameredirects([string tolower [HTTP::host]])[HTTP::uri]
}
}
Now we just put oldname newurl pairs in the RULE_INIT and no one has to wake up in the middle of the night to change it over on 6/1. Of course I will probably be awake then anyway... üôÇ
Regards,
-Alan