Reputation:
I would prefer to use Javascript for this, but any language is fine.
I am redesigning my web page. It will be released at 12:00am on July 31. I have put both versions of the site into different directories. I want this code on the home page to redirect the user to the correct page based on the date.
Example: User logs on at 5:00pm on June 29 --> Redirected to /current. User logs in at 1:00pm on August 1 --> Redirected to /new.
Upvotes: 1
Views: 4470
Reputation: 13978
Using following javascript you can do this.
// For todays date;
Date.prototype.today = function () {
return ((this.getDate() < 10)?"0":"") + this.getDate() +"/"+(((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ this.getFullYear();
}
if((new Date().today()) >= "01/08/2014")
{
location.href ="new location url";
}
else
{
location.href="current location url";
}
Upvotes: 1
Reputation: 414
if (time() < strtotime("06/29/2014 5:00PM"))
{
//redirect to current
header("Location : http://website.com/current");
exit;
}
elseif(time() > strtotime("01/08/2014 1:00PM")){
//redirect to new
header("Location : http://website.com/new");
exit;
}
Upvotes: 1