...

View Full Version : Redirect depending on year and month ??



Peuplarchie
07-02-2007, 10:17 PM
Good day to all,
I need someone to help me find a way to do a check date on server and depending of year go to the page of this month of this year.

I know it problably not the way it just that Iwanted to give an example :




$200701 = header("Location: http://www.example.com/2007/01.html");
$200702 = header("Location: http://www.example.com/2007/02.html");
$200703 = header("Location: http://www.example.com/2007/03.html");
$200704 = header("Location: http://www.example.com/2007/04.html");
$200705 = header("Location: http://www.example.com/2007/05.html");
$200706 = header("Location: http://www.example.com/2007/06.html");
$200707 = header("Location: http://www.example.com/2007/07.html");
$200708 = header("Location: http://www.example.com/2007/08.html");
$200709 = header("Location: http://www.example.com/2007/09.html");
$200710 = header("Location: http://www.example.com/2007/10.html");
$200711 = header("Location: http://www.example.com/2007/11.html");
$200712 = header("Location: http://www.example.com/2007/12.html");

$200801 = header("Location: http://www.example.com/2008/01.html");
$200802 = header("Location: http://www.example.com/2008/02.html");
$200803 = header("Location: http://www.example.com/2008/03.html");
$200804 = header("Location: http://www.example.com/2008/04.html");
$200805 = header("Location: http://www.example.com/2008/05.html");
$200806 = header("Location: http://www.example.com/2008/06.html");
$200807 = header("Location: http://www.example.com/2008/07.html");
$200808 = header("Location: http://www.example.com/2008/08.html");
$200809 = header("Location: http://www.example.com/2008/09.html");
$200810 = header("Location: http://www.example.com/2008/10.html");
$200811 = header("Location: http://www.example.com/2008/11.html");
$200812 = header("Location: http://www.example.com/2008/12.html");

$year = date("Y");
if ( $year == "2008" ) {

$month = date("m");
else if ($month == "01" ) {
$result = $200801;
}

else if ($month == "02" ) {
$result = $200802;
}

else if ($month == "03" ) {
$result = $200803;
}

else if ($month == "04" ) {
$result = $200804;
}

else if ($month == "05" ) {
$result = $200805;
}

else if ($month == "06" ) {
$result = $200806;
}

else if ($month == "07" ) {
$result = $200807;
}

else if ($month == "08" ) {
$result = $200808;
}

else if ($month == "09" ) {
$result = $200809;
}

else if ($month == "10" ) {
$result = $200810;
}

else if ($month == "11" ) {
$result = $200811;
}

else if ($month == "12" ) {
$result = $200812;
}





}

devinemke
07-02-2007, 10:31 PM
header('location: http://www.example.com/' . date('Y') . '/' . date('m') . '.html');

Peuplarchie
07-03-2007, 01:56 AM
header('Location: http://www.example.com/'.date('Y').'/'.date('m').'.html');
exit;


is the answer

Peuplarchie
07-03-2007, 01:58 AM
ho Thanks aslo :

devinemke and temps.user123



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum