WordPress.org

Ready to get started?Download WordPress

Forums

Google Sitemaps - 404 Verification Problem (22 posts)

  1. ThomasHolmes
    Member
    Posted 8 years ago #

    Hi there,

    I have submitted my sitemap to Google Sitemaps and am getting a verification error - 'We've detected that your 404 (file not found) error page returns a status of 200 (OK) in the header.'

    Now I followed the instructions on:

    http://codex.wordpress.org/Creating_an_Error_404_Page#Tips_for_Error_Pages

    and added the 404 header line so that my 404 template is now as follows:

    <?php header("HTTP/1.1 404 Not Found"); ?>
    <?php get_header(); ?>

    <div id="content" class="narrowcolumn">

    <h2 class="center">Error 404 - Not Found</h2>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    But Google is still insistently giving the same error. You can see an example of an error page on my site at:

    http://www.contemporary-artists.info/karamba/

    Anyone any ideas what this could be? Thanks in advance!

    Thomas

  2. niziol
    Member
    Posted 8 years ago #

    Try using <?php header('Status: 404 Not Found'): ?>. You can check your server headers using this tool.

  3. ThomasHolmes
    Member
    Posted 8 years ago #

    Thanks for the suggestions niziol! That tool is pretty handy. I've figured out now that wp is not returning the 404.php template when there is a 404. Instead it is returning the archive.php template.

    I also seem to have two archive files - archive.php and archives.php - not sure if this is normal.

    So the problem now is to try and get wp to use the 404.php for 404s instead of the archive.php.

    Back to the codex... If anyone has any ideas!

    Thomas

  4. niziol
    Member
    Posted 8 years ago #

    The archive.php and archives.php are both normal. What version of WP are you using?

  5. ThomasHolmes
    Member
    Posted 8 years ago #

    wp2.0

    yeah, had just about figured out the two archives were normal! still don't know why wp is giving out the archive.php instead of the 404.php

  6. gegresh
    Member
    Posted 8 years ago #

    I've been having the same exact problem. I even edited my .htaccess file to point to a 404 php page with the single line <?php header('Status: 404 Not Found'): ?> . But Google still won't verify it.

  7. ThomasHolmes
    Member
    Posted 8 years ago #

    Ok, so when a non-existant webpage is requested, wp is returning with the archive.php and not the 404.php.

    I've gone through I dunno how many pages on the codex and can't find an explanation for this. According to the Template Hierarchy the hierarchy for an error is

    (1) 404.php
    (2) index.php

    Now i've tried deleting the 404.php file and creating it again from scratch. Just in case there was something wrong with the file. That hasn't changed anything though.

    I'd appreciate suggestions as I'm pretty much out of ideas - thanks!

    Thomas

  8. gegresh
    Member
    Posted 8 years ago #

    Yeah, now I'm having the problem that even when I type in the name of a page that I know isn't there, it just loads the main index file. Ugh.

  9. ThomasHolmes
    Member
    Posted 8 years ago #

    hi gegresh,

    nice to hear i'm not the only one with this problem!

    did you try putting the <?php header('Status: 404 Not Found'): ?> or <?php header("HTTP/1.1 404 Not Found"); ?> in your 404.php?

    if you did and that didn't work. have you figured out that a different template is being used to generate the error page?

    thomas

  10. niziol
    Member
    Posted 8 years ago #

    Hmm, I think that is very, very odd - it should do exactly at the hierarchy dictates. Maybe try an update to 2.0.1.

    Sorry I don't have any suggestions, hopefully someone else will!

    Cheers,
    Michael.

  11. ThomasHolmes
    Member
    Posted 8 years ago #

    Ok, will have a look at whats involved in updating to 2.0.1. Thanks a lot for your help Michael!

  12. dangerpop
    Member
    Posted 7 years ago #

    This is the end all, or at least was for me. THIS is EXACTLY what your .htaccess file should look like to get rid of that irritating 200error thing:
    ---
    # BEGIN WordPress
    #<IfModule mod_rewrite.c>
    #RewriteEngine On
    #RewriteBase /
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule . /index.php [L]
    #</IfModule>

    # END WordPress
    ---
    That's IT. The # in front of each line is just telling the server to ignore the line... you can always remove it if you'd like to back to the old 200 error thing.

  13. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Err... without those, then "pretty" permalinks won't work.

  14. Marcomail
    Member
    Posted 7 years ago #

    I've the same problem, to verify the site the only way is delete or rename .htaccess, after this you can restore the htaccess.

    I don't know why google return this error, i try some online software like http://www.seoconsultants.com/tools/headers.asp and for an head request it return a 404 for non-existent files...

  15. Marcomail
    Member
    Posted 7 years ago #

    up

  16. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    This is almost always a problem with your permalink settings. What do you have those set to?

  17. Marcomail
    Member
    Posted 7 years ago #

    thanks Otto for the support :)

    the permalinks structure is set to:

    /%year%/%monthnum%/%day%/%postname%/

    I don't understand why 404 pages (with 404 for a head request) are not 404 pages, but 200 Ok

  18. Chris_K
    Member
    Posted 7 years ago #

    Because WP finds your 404.php page?

    Edit: Ok, that's probably too naive to be true...

  19. Marcomail
    Member
    Posted 7 years ago #

    Yes...i've tried to modify my 404.php page and it works, when i call a non-existing pages the 404 page is called correctly from wordpress.

    I have a lot of 404 error pages but are not logged from apache...the only way to verify the site is deleting the .htaccess, but google sometimes ask the verification files so everytime i must delete/rename the htaccess; but the big problem is google see 404 pages like 200, so index all this pages and see this like a copy and put me in penalty :(

  20. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    My 404 pages actually return 404's. I'd say that you have some kind of plugin interfering or something.

  21. Marcomail
    Member
    Posted 7 years ago #

    But i'm not the only, other people have this problem if you search on google :( also my 404.php page return 404...but i don't know why google see it like a 200 ok, and it's the strange Apache log without 404 error pages

  22. Marcomail
    Member
    Posted 7 years ago #

    Arghhhhhhhhhh OTTOOOOOOOOOO I LOVE YOU!! I tried to disable all my plugins and....after i have disabled wp-postratings google verify my site!!!!!!!!!!! YUPPPPPPPPPPPIIIIIIII

Topic Closed

This topic has been closed to new replies.

About this Topic