miltonreck Posted August 12, 2011 Share Posted August 12, 2011 I need a way to redirect my homepage at 5:00PM to a different page until 9:00AM. is there a way to even do this? Quote Link to comment Share on other sites More sharing options...
cl58 Posted August 12, 2011 Share Posted August 12, 2011 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. Quote Link to comment Share on other sites More sharing options...
Byron Posted August 13, 2011 Share Posted August 13, 2011 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.