WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Permalinks not giving custom 404 error page. (5 posts)

  1. ckortman
    Member
    Posted 6 years ago #

    Alrighty, here we go. 1st post on the WP forums. I will try to be short and sweet.

    i have WP 2.2.3, PHP 4.4.7, mysql 4.1 (Client API version 3.23.49 ) and Apache 2.0.59.

    mod_rewrite is enabled and working. (permalinks are working 100% correctly for posts and categories).

    my problem is thus: my error pages do not display! i can see clearly on the Apache Access Log the following:

    <IP deleted> - - [02/Jan/2008:11:22:01 +1100] "GET /about/asd HTTP/1.1" 404 14235
    <IP deleted> - - [02/Jan/2008:11:22:15 +1100] "GET /about/ad/g/adfg/d/fg/adfg/dafg/ HTTP/1.1" 404 14235

    so the 404 error DOES actually happen, but the 404.php page is never actually displayed. without permalinks (ie on default), the 404 page is correctly displayed.

    here is the contents of my .htaccess file:
    ErrorDocument 404 /404.php

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    wordpress is currently installed on the root directly. The server is running Windows XP SP2.

    Currently, with permalinks on:
    /%year%/%monthnum%/%day%/%postname%/

    upon a 404 error, the browser just returns to the index page. The 404.php page does NOT get loaded at any stage, as currently i am emailed automatically upon any 404 error via a script on the page. (and apache logs do not indicate 404.php is being loaded.)

    thank you for your help.

  2. moshu
    Member
    Posted 6 years ago #

    You don't need anything in the htaccess - just have your 404 template in your theme directory.

  3. ckortman
    Member
    Posted 6 years ago #

    hah! magic. Would you be able to explain WHY the default location of the 404.php seems to have moved from the blog's home directory to the theme directory? I cant seem to make any sense out of it.

  4. moshu
    Member
    Posted 6 years ago #

    I don't remember it ever being in the WP root...

    In this way you can have custom 404 pages for every theme.

  5. ckortman
    Member
    Posted 6 years ago #

    My apologies, reading more closely in the custom 404 section of this site, I see a paragraph about what happens if a theme doesnt have a 404 page in its directory. That will learn me be in a rush and gloss over things too much.

    I think that I thought that since the .htaccess was in the blog's main directory, the path I had chosen for it was also correct.

    Thanks for your quick reply!

Topic Closed

This topic has been closed to new replies.

About this Topic