WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Steals 404 (7 posts)

  1. ryryo
    Member
    Posted 8 years ago #

    I have been trying to define my own 404 page in the htaccess file but I have found that WordPress seems to take over it no matter what. I guess the code that the permalinks puts in there makes it send anything to index.php. Unfortunately, anything that is not a found file, ends up going there.

    This wouldn't be all that bad but, I like to see my real stats and having my stats monitor index.php isn't doing anything since all these 404s are coming in on it.

    Is there a way to make wordpress stop taking over not found documents? I never had a problem until they came up with the 5 line htaccess.

    Here is what wordpress puts in my htaccess file:

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

    Thank you for any help.

  2. cam_oai
    Member
    Posted 8 years ago #

    *bump*

    i just got the same prob, change the permalink to /year/date/stuff/ links and now my 404 is gone.....

    has any1 solved it?

  3. mikeleeorg
    Member
    Posted 8 years ago #

    Not that this is of much help, but I've been wrestling with a similar problem and found that if set your permalinks structure back to its default setting, you can use your own 404 page again.

    I haven't figured out how to have a proper custom 404 page with a custom permalinks structure yet though... still trying to figure that one out...

  4. dutch_gecko
    Member
    Posted 8 years ago #

    I'm also interested in this one.

    Would it not be possible to write a plugin/hack that forces wordpress to retreive a nonexistant file every time index.php is fed an incorrect URL? So if I access example.com/category/doesnotexist wordpress secretly requests nonexistant.html from the server? Or would this give the same problem...

    edit @ sc567: That's a good idea, I'll try that in a second or two.

  5. sc567
    Member
    Posted 8 years ago #

    Haven't tried it myself, but try to include (and remove everything else) this in your 404-template page ('404.php'):

    <?php
    header('Location: /location/of/own/404');
    ?>

    Or the other way around: put in your .htaccess:
    ErrorDocument 404 /404 (which doesn't exist ofcourse :P), which will redirect all out-of-wp-404's to your wp-404 (if it exist with a 404.php or another template with is_404() in it)

    Hope this helps

  6. mikeleeorg
    Member
    Posted 8 years ago #

    Just in case this helps someone here, the cause of this problem for me was using FastCGI. A fix has been documented here.

  7. Xenomorph
    Member
    Posted 8 years ago #

    the FastCGI fix does nothing for me.

    also, i just dont understand the .htaccess rules.

    every request for a non existant file gets sent to /index.php. and then what?

    no matter what changes i make to permalinks, 404s never show up. this has been totally messing up my logs.

Topic Closed

This topic has been closed to new replies.

About this Topic