Jump to content

Recommended Posts

Posted

If this is a one-time thing, the easiest way to do it would be to just add the following line of code to your homepage in the <head> section at 5 and remove it at 9.

 

<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">

(replace http://www.yourdomain.com/index.html with where you want users to be redirected to)

 

If it is a daily thing, some more coding will be required.

Posted

You can do this with htaccess. There's got to be a better regex for the time span, but this is a rough way of doing it:

 

RewriteEngine On
RewriteCond %{TIME_HOUR} ^17|18|19|20|21|22|23|00|01|02|03|04|05|06|07|08|09$
RewriteRule ^$|^index\.html$ /time-restricted.html [R=302,L]

 

 

A better way to write the time (untested):

 

RewriteEngine On
RewriteCond %{TIME_HOUR}%{TIME_MIN} >1700
RewriteCond %{TIME_HOUR}%{TIME_MIN} <0900
RewriteRule ^$|^index\.html$ /time-restricted.html [R=302,L]

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...