Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31441
Modified Files:
index.php
Log Message:
When the user requests a non-existant resource, we should return a 404, not 200.
Index: index.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/index.php,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- index.php 20 Nov 2004 19:26:43 -0000 1.57
+++ index.php 21 Nov 2004 03:20:01 -0000 1.58
@@ -186,8 +186,8 @@
serendipity_plugin_api::hook_event('external_plugin', $matches[1]);
exit;
} else if (preg_match(PAT_CATEGORIES, $uri, $matches) ||
- preg_match('@/(index\.(php|html))?@', $uri) ||
- preg_match('@/(' . preg_quote($serendipity['indexFile']) . ')?@', $uri)) {
+ preg_match('@/(index(\.php|\.html)?)|'. preg_quote($serendipity['indexFile']) .'@', $uri) ||
+ preg_match('@^/' . preg_quote(trim($serendipity['serendipityHTTPPath'], '/')) . '/?(\?.*)?$@', $uri)) {
if (count($serendipity['GET']) == 2) {
if (isset($matches) && is_array($matches) && isset($matches[1])) {
@@ -216,7 +216,9 @@
include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
}
} else {
- printf(DOCUMENT_NOT_FOUND, $uri);
+ header('HTTP/1.0 404 Not found');
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+ printf('<div class="serendipity_msg_important">' . DOCUMENT_NOT_FOUND . '</div>', $uri);
}
if ($track_referer) {
|