homepage Welcome to WebmasterWorld Guest from 54.211.100.183
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Content Management
Forum Library, Charter, Moderators: ergophobe

Content Management Forum

    
Wordpress 404 problem
404 header not being returned
lee_sufc

10+ Year Member



 
Msg#: 3655691 posted 7:54 pm on May 21, 2008 (gmt 0)

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

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



 
Msg#: 3655691 posted 8:53 pm on May 21, 2008 (gmt 0)

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

WebmasterWorld Administrator ergophobe us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3655691 posted 5:23 pm on May 22, 2008 (gmt 0)

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

5+ Year Member



 
Msg#: 3655691 posted 8:51 am on Jul 6, 2008 (gmt 0)

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

WebmasterWorld Administrator ergophobe us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3655691 posted 4:09 pm on Jul 7, 2008 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Content Management
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved