Warning: strftime() [function.strftime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /usr/local/www/nat.guyton.net/geeklog-1.4.0sr2/public_html/lib-common.php on line 4396
Warning: strftime() [function.strftime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /usr/local/www/nat.guyton.net/geeklog-1.4.0sr2/public_html/lib-common.php on line 4396
Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /usr/local/www/nat.guyton.net/geeklog-1.4.0sr2/public_html/lib-common.php on line 5531
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /usr/local/www/nat.guyton.net/geeklog-1.4.0sr2/public_html/lib-common.php on line 1143 Nat's Geeklog - Apache: time-sensitive redirects, backdoor entry
Apache's mod_rewrite can be used to do time-sensitive redirects... handy if you have to make a scheduled change at an inconvenient time. But even better, what if you need to get to the original site? This example also includes a url /backdoor that sets a 15 min cookie, redirects to the main page, and an exclusion to not redirect anyone who has that cookie set. Cool stuff.
RewriteEngine On
# Start redirecting after this datetime
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY}%{TIME_HOUR}%{TIME_MIN} >200904040900
# Don't redirect certain paths
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/webservices
RewriteCond %{REQUEST_URI} !^/backdoor
# Don't redirect if backdoor cookie is active
RewriteCond %{HTTP_COOKIE} !backdoor
# Do the rewrite
RewriteRule .* http://mynewhostname/ [R,L]
# Allow back door access to old site (this site) - hit /backdoor and they get a cookie for
# 15 mins such that they won't be redirected while it is active.
RewriteRule ^/backdoor http://myoldhostname/ [CO=backdoor:yes:myoldhostname:15:/]