Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2003
    San Francisco
    Thanked 0 Times in 0 Posts

    PHP - internal redirect without mod_rewrite

    I have blog pages archived by month, and I want to serve the most recent month's page when someone accesses the blog's (virtual) home page. But, I don't want an external redirect. I'm currently using this PHP to solve the issue, but assume there's a more elegant solution?
    PHP Code:
    = @fopen'http://muledesign.hoologic.com/hoof/2004/february/''r' ) or die( 'Heh.' );
            while ( 
    $line = @fgets$fp1024 ) ) {
    fclose$fp );
    I name this page index.php, so it acts as my blog's home page.

    Note that the URL to the most recent monthly archive is embedded in the source. The blog software is thus generating this page for me, which is why I don't want to use mod_rewrite. As I have it set up now, I don't need to change anything when a new month arrives. As soon as I post a blog entry in a new month, this page (above) is regenerated to "redirect" to the new monthly archive page.


  • #2
    Super Moderator
    Join Date
    May 2002
    Perth Australia
    Thanked 101 Times in 99 Posts
    Not quite sure if this is what you meant but anyway ...

    PHP Code:
    'http://muledesign.hoologic.com/hoof/' date'Y' ) . '/' strtolowerdate'F' ) ) . '/';
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


    Posting Permissions

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