WordPress.org

Forums

.htaccess troubles (4 posts)

  1. Babalao
    Member
    Posted 9 years ago #

    Why doesn't a standard 404 redirect work in 2.0.x ?

    .htaccess= ErrorDocument 404 /index.php

    I just get a message on a template page: Sorry, no posts matched your criteria.

    I don't want that. I want 404 pages to rediret to the root.

    What seems to be wrong?

    Thank you,

    Babalao

  2. Kafkaesqui

    Posted 9 years ago #

    Try changing that line in your .htaccess to:

    ErrorDocument 404 /index.php?error=404

    Then add a 404.php template to your theme. Easiest way to do that is to copy index.php (to 404.php), then edit (or edit out) The Loop to display whatever you think is appropriate.

    (Note the .htaccess stuff may not be necessary in 2.0.x, but covering all the bases here.)

  3. Babalao
    Member
    Posted 9 years ago #

    Ok,

    That sounds easy enough.

    Then I can just code 404.php to redirect to root.

    Thank you.

  4. Babalao
    Member
    Posted 9 years ago #

    Hey, that worked perfectly. here's the contents to 404.php BTW:

    <?php
    $url[0]='/';
    $url[1]='/';
    srand((double)microtime()*1234567);
    $turl=$url[intval(rand(0,1))];
    header("location: $turl");
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.