Forum Discussion
demmo_251289
Nimbostratus
Jun 07, 2016Temporary redirect
Hello, is there a way to set up a page redirect to expire after a year ?
Thank you
Vijay_E
Cirrus
Jun 07, 2016https://devcentral.f5.com/codeshare/time-based-irule-example
when RULE_INIT {
Start of maintenance window in YYYY-mm-dd HH:MM format
set static::start_date "2016-05-29 18:45"
End of maintenance window in YYYY-mm-dd HH:MM format
set static::end_date "2017-05-29 18:45"
Convert start/end times to seconds from the epoch for easier date comparisons
set static::start [clock scan $static::start_date]
set static::end [clock scan $static::end_date]
}
when CLIENT_ACCEPTED {
Get the current time in seconds since the Unix epoch of 0-0-1970
set now [clock seconds]
Check if the current time is between the start and end times
if {$now > $static::start and $now < $static::end}{
HTTP::respond 301 Location "https://domain.com/"
}
Default action is to use the virtual server default pool
}
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