[wp-trac] Re: [WordPress Trac] #7808: Incorrect HTTP on 404
WordPress Trac
wp-trac at lists.automattic.com
Tue Sep 30 03:25:51 GMT 2008
#7808: Incorrect HTTP on 404
------------------------+---------------------------------------------------
Reporter: ojreadmore | Owner: anonymous
Type: defect | Status: new
Priority: high | Milestone: 2.8
Component: General | Version:
Severity: major | Resolution:
Keywords: |
------------------------+---------------------------------------------------
Comment (by greaterweb):
I did a little research on this and I can point you in the right direction
to get a jump start towards a fix.
In wp-includes/classes.php, when the script is looping through the rewrite
rules it finds a match with two rewrite rules it shouldn't.
The two rules are:
{{{
(.+?)(/[0-9]+)?/?$
}}}
and
{{{
([^/]+)(/[0-9]+)?/?$
}}}
The pattern is matched with preg_match on lines 104-105. With the match
found, $error is unset at 125. This kills the 404 header from being sent.
Further along when WP discovers the page does not exist, the 404 template
is served up. The issue is the 200 header is still sent to the browser.
I tried to do a few inline fixes to $match when either of those rules were
presented. I was able to get the proper header to serve up for some
situations, but not all.
On a related note, if the permalink structure is set to default, 404's
don't work at all. 200 header sent and the home page gets served.
--
Ticket URL: <http://trac.wordpress.org/ticket/7808#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list