Index: trunk/phase3/includes/SpecialPageFactory.php |
— | — | @@ -429,7 +429,12 @@ |
430 | 430 | if ( !$page ) { |
431 | 431 | $context->getOutput()->setArticleRelated( false ); |
432 | 432 | $context->getOutput()->setRobotPolicy( 'noindex,nofollow' ); |
433 | | - $context->getOutput()->setStatusCode( 404 ); |
| 433 | + |
| 434 | + global $wgSend404Code; |
| 435 | + if ( $wgSend404Code ) { |
| 436 | + $context->getOutput()->setStatusCode( 404 ); |
| 437 | + } |
| 438 | + |
434 | 439 | $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' ); |
435 | 440 | wfProfileOut( __METHOD__ ); |
436 | 441 | return false; |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -917,7 +917,7 @@ |
918 | 918 | * namespace, show the default message text. To be called from Article::view(). |
919 | 919 | */ |
920 | 920 | public function showMissingArticle() { |
921 | | - global $wgOut, $wgRequest, $wgUser; |
| 921 | + global $wgOut, $wgRequest, $wgUser, $wgSend404Code; |
922 | 922 | |
923 | 923 | # Show info in user (talk) namespace. Does the user exist? Is he blocked? |
924 | 924 | if ( $this->getTitle()->getNamespace() == NS_USER || $this->getTitle()->getNamespace() == NS_USER_TALK ) { |
— | — | @@ -979,7 +979,7 @@ |
980 | 980 | } |
981 | 981 | $text = "<div class='noarticletext'>\n$text\n</div>"; |
982 | 982 | |
983 | | - if ( !$this->mPage->hasViewableContent() ) { |
| 983 | + if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) { |
984 | 984 | // If there's no backing content, send a 404 Not Found |
985 | 985 | // for better machine handling of broken links. |
986 | 986 | $wgRequest->response()->header( "HTTP/1.1 404 Not Found" ); |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -262,7 +262,7 @@ |
263 | 263 | |
264 | 264 | protected function openShowImage() { |
265 | 265 | global $wgOut, $wgUser, $wgImageLimits, $wgRequest, |
266 | | - $wgLang, $wgEnableUploads; |
| 266 | + $wgLang, $wgEnableUploads, $wgSend404Code; |
267 | 267 | |
268 | 268 | $this->loadFile(); |
269 | 269 | |
— | — | @@ -481,7 +481,7 @@ |
482 | 482 | // by Article::View(). |
483 | 483 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
484 | 484 | $wgOut->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile ); |
485 | | - if ( !$this->getID() ) { |
| 485 | + if ( !$this->getID() && $wgSend404Code ) { |
486 | 486 | // If there is no image, no shared image, and no description page, |
487 | 487 | // output a 404, to be consistent with articles. |
488 | 488 | $wgRequest->response()->header( 'HTTP/1.1 404 Not Found' ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2471,6 +2471,18 @@ |
2472 | 2472 | */ |
2473 | 2473 | $wgBetterDirectionality = true; |
2474 | 2474 | |
| 2475 | +/** |
| 2476 | + * Some web hosts attempt to rewrite all responses with a 404 (not found) |
| 2477 | + * status code, mangling or hiding MediaWiki's output. If you are using such a |
| 2478 | + * host, you should start looking for a better one. While you're doing that, |
| 2479 | + * set this to false to convert some of MediaWiki's 404 responses to 200 so |
| 2480 | + * that the generated error pages can be seen. |
| 2481 | + * |
| 2482 | + * In cases where for technical reasons it is more important for MediaWiki to |
| 2483 | + * send the correct status code than for the body to be transmitted intact, |
| 2484 | + * this configuration variable is ignored. |
| 2485 | + */ |
| 2486 | +$wgSend404Code = true; |
2475 | 2487 | |
2476 | 2488 | /** @} */ # End of output format settings } |
2477 | 2489 | |