[wp-cvs] wordpress wp-blog-header.php,1.99,1.100

Ryan Boren rboren at users.sourceforge.net
Wed Nov 10 04:01:48 UTC 2004


Update of /cvsroot/cafelog/wordpress
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32329

Modified Files:
	wp-blog-header.php 
Log Message:
Issue a 404 if a permalink request does not match any posts.

Index: wp-blog-header.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-blog-header.php,v
retrieving revision 1.99
retrieving revision 1.100
diff -C2 -d -r1.99 -r1.100
*** wp-blog-header.php	2 Nov 2004 02:08:17 -0000	1.99
--- wp-blog-header.php	10 Nov 2004 04:01:46 -0000	1.100
***************
*** 185,188 ****
--- 185,198 ----
  }
  
+ // Issue a 404 if a permalink request doesn't match any posts.  Don't issue a
+ // 404 if one was already issued, if the request was a search, or if the
+ // request was a regular query string request rather than a permalink request.
+ if ( (0 == count($posts)) && !is_404() && !is_search()
+ 		 && !empty($_SERVER['QUERY_STRING']) &&
+ 		 (false === strpos($_SERVER['REQUEST_URI'], '?')) ) {
+ 	$wp_query->is_404 = true;
+ 	header("HTTP/1.x 404 Not Found");
+ }
+ 
  $wp_did_header = true;
  endif;




More information about the cvs mailing list