Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JackT06

macrumors 6502
Original poster
Jul 24, 2009
293
0
Hello,

Does anyone know a way that i can make my website redirect users to a specific page, BUT i can set a time when the redirect will automatically disable....

The plan is that we need to do some major updates to our website, and then make sure people don't see them till 11 o'clock, BUT, no-one is around to disable the redirect, so we need it to work automatically....

HELP!:(
 
Looks like somebody will be staying late. ;)

Seriously the best way to do a one-off like this is to have somebody stay and make the change.

Otherwise you should be able to setup your web server to handle a timed redirect.

Or you can trigger a script at the top of the page that redirects based on time.

I wouldn't really recomend either but it is possible.
 
This should help

Hey bud, this should help if you are using PHP and don't mind the browser doing the redirect. If you don't want the server to physically serve the page until a specific date you will need to look at .htaccess files

Otherwise this should help


Code:
<?php
$date_var = date("ymdHis", time());

// The date is formatted in year month day hour minute second.
// eg. 13:01:50 on the 3rd of March 2011 will be 20110303130150
// Simply choose the date and time you want the redirect to finish
// Remember the time set on your server might be different to your local machine
// Change <= to >= to output the html before the date you have chosen

if($date_var <= "110318092415"){ ?>
	
<meta http-equiv="refresh" content="0;url=http://example.com/" />

<?php } ?>
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.