Changeset 1850

Show
Ignore:
Timestamp:
11/10/04 04:01:46 (4 years ago)
Author:
rboren
Message:

Issue a 404 if a permalink request does not match any posts.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-blog-header.php

    r1842 r1850  
    185185} 
    186186 
     187// Issue a 404 if a permalink request doesn't match any posts.  Don't issue a 
     188// 404 if one was already issued, if the request was a search, or if the 
     189// request was a regular query string request rather than a permalink request. 
     190if ( (0 == count($posts)) && !is_404() && !is_search() 
     191         && !empty($_SERVER['QUERY_STRING']) && 
     192         (false === strpos($_SERVER['REQUEST_URI'], '?')) ) { 
     193    $wp_query->is_404 = true; 
     194    header("HTTP/1.x 404 Not Found"); 
     195} 
     196 
    187197$wp_did_header = true; 
    188198endif;