Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    Post Redirect depending on year and month ??

    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 :


    PHP Code:
    $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;
    }







  • #2
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    PHP Code:
    header('location: http://www.example.com/' date('Y') . '/' date('m') . '.html'); 

  • #3
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post
    PHP Code:
    header('Location: http://www.example.com/'.date('Y').'/'.date('m').'.html');
    exit; 
    is the answer

  • #4
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post
    ho Thanks aslo :

    devinemke and temps.user123


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •