Welcome to WebmasterWorld Guest from 54.226.62.26

Forum Moderators: ergophobe

Message Too Old, No Replies

Wordpress 404 problem

404 header not being returned

     

lee_sufc

7:54 pm on May 21, 2008 (gmt 0)

10+ Year Member



I have posted a similar subject in another forum but thought maybe it would be a good idea to ask here:

Basically, I have a Wordpress blog in a subdirectory of my site (have done for years). I have just upgraded to 2.5.1 and have just noticed a problem.

Basically, if you try and load a page that does not exist, rather than returning the usual 404 response, I get nothing - NO header response at all, just a blank page?!?

My permalink structure is /%postname%/ and in my htaccess I have:

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

# END WordPress

Can anyone here help?

jdMorgan

8:53 pm on May 21, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I can explain but probably not help, since "helping" may require that you modify the WordPress code...

Your mod_rewrite code says:

IF the requested URL does not resolve to an existing file
AND
IF the requested URL does not resolve to an existing directory (or folder, if you prefer)
THEN
Rewrite the request to WordPress at /blog/index.php

Therefore, if you request a non-existent page, the request will be sent to WordPress, and it is up to WordPress to determine whether or not that page exists and to handle it properly.

Evidently, WP is not handling it properly (at least not on your installation). I don't mess with WP, so there may be some option you can set somewhere that causes it to check for invalid "WP post" requests and to return a 404 if needed -- I don't know.

Jim

ergophobe

5:23 pm on May 22, 2008 (gmt 0)

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Wordpress should handle 404s just fine - and yes it is handled internally, but I always get a valid 404 if I ask for a non-existen page. A lot of effort has been put into dupe content and improper header issues.

If you are getting an absolute blank page, that to me sounds like you have a PHP error and you have error reporting off or WP does its own error handling and displays nothing. Unfortunately, WP has no system log so it doesn't tell you what errors might happen (only on plugin activation).

Do you have any plugins that fire on 404? Try disabling all your plugins and requesting a non-existent page.

paultantk

8:51 am on Jul 6, 2008 (gmt 0)

5+ Year Member



wordpress does not seem to be handling 404 errors properly on blogname.com/?p=123 pages where the 123 post id does not exist.

i solved it by adding this to the top of my theme's header.php file


<?php
if (is_single() && !have_posts())
{
header("HTTP/1.0 404 Not Found");
}
?>

ergophobe

4:09 pm on Jul 7, 2008 (gmt 0)

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Thanks Paul. Is this with WP2.5?

I know they put a lot of effort into getting the right return status codes, so I'm sort of surprised this is still a problem.

It just goes to show, though, that it's still important to feed a bad URL to WP and see what headers get returned.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month