Web Analytics Made Easy -
StatCounter PHP - internal redirect without mod_rewrite - CodingForum

Announcement

Collapse
No announcement yet.

PHP - internal redirect without mod_rewrite

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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:
    <?php
        $fp 
    = @fopen'http://muledesign.hoologic.com/hoof/2004/february/''r' ) or die( 'Heh.' );
            while ( 
    $line = @fgets$fp1024 ) ) {
                print 
    $line;
                }
        
    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.

    Ideas?

  • #2
    Not quite sure if this is what you meant but anyway ...

    PHP Code:
    <?
    $url 
    '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)

    Comment

    Working...
    X