[wp-trac] Re: [WordPress Trac] #2376: Custom 404 page error/conflict with permalinks

WordPress Trac wp-trac at lists.automattic.com
Fri Nov 17 07:36:44 GMT 2006

#2376: Custom 404 page error/conflict with permalinks
 Reporter:  vsa                    |        Owner:  anonymous
     Type:  defect                 |       Status:  reopened 
 Priority:  normal                 |    Milestone:           
Component:  General                |      Version:  2.0      
 Severity:  normal                 |   Resolution:           
 Keywords:  404 custom permalinks  |  
Comment (by RuddO):

 There's a simple explanation for this.

 The ErrorDocument stanza in Apache config files is not being executed.

 A better explanation:

 The default mod_rewrite stanzas that WordPress feeds into .htaccess say
 something that, translated in words, roughly means:

 "Hand every request to index.php for processing, *unless* it's a request
 for an existing file or directory".

 Thus, with permalinks enabled, any request for a page not found will go to
 the index.php file.  Deep inside the guts of WP (class WP_Rewrite and
 class WP, to be exact) there's code to determine if the request was for a
 post that did not exist (which actually also covers the cases of
 nonexistant files or directories).

 When a request is received by WP and WP can't find data to send (posts,
 pages, etcetera), WP simply uses your _theme's_ 404.php file to display
 the error in the blog format, and sends it back to the user, along with a
 404 Not Found status.

 So, in other words, ErrorDocument 404 stanzas will never work if you're
 also using permalinks.

 Got it?

Ticket URL: <http://trac.wordpress.org/ticket/2376#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list