miltonreck Posted August 12, 2011 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?
cl58 Posted August 12, 2011 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.
Byron Posted August 13, 2011 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]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now