Last active
August 29, 2018 20:59
-
-
Save earth3300/929ff840224a618c1387bbeac02dd664 to your computer and use it in GitHub Desktop.
Time of day based page dispaly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Time of day based page display. | |
<IfModule mod_rewrite.c> | |
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteBase / | |
# 5am > < 8am | |
RewriteCond %{TIME_HOUR} >02 | |
RewriteCond %{TIME_HOUR} <05 | |
RewriteRule ^index\.html$ /page/time-of-day/morning.html | |
# 8am > < 4pm | |
RewriteCond %{TIME_HOUR} >05 | |
RewriteCond %{TIME_HOUR} <13 | |
RewriteRule ^index\.html$ /page/time-of-day/midday.html | |
# 4pm > < 10pm | |
RewriteCond %{TIME_HOUR} >13 | |
RewriteCond %{TIME_HOUR} <19 | |
RewriteRule ^index\.html$ /page/time-of-day/afternoon.html | |
# 10pm > < 5am | |
RewriteCond %{TIME_HOUR} >19 | |
RewriteCond %{TIME_HOUR} <02 | |
RewriteRule ^index\.html$ /page/time-of-day/night.html | |
</IfModule> | |
# Displays a different page, depending on the time of day. | |
# @link https://www.askapache.com/htaccess/time_hour-rewritecond-time/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment