(Translated by https://www.hiragana.jp/)
⚓ T14345 Server should return a 410 HTTP status code for deleted pages
Page MenuHomePhabricator

Server should return a 410 HTTP status code for deleted pages
Closed, DeclinedPublic

Description

Author: psychonaut

Description:
As per RFC 2616, MediaWiki should return a 410 HTTP status code (410 Gone) for pages which have been deleted. This will assist search engines, link checkers, and other automated tools in removing links to wiki pages which no longer exist. Note that MediaWiki can still display whatever web page it normally does when the user accesses a deleted page; it's just the HTTP status code which should be altered (from 200 OK to 410 Gone).

See also Bug 2585.


Version: unspecified
Severity: minor

Details

Reference
bz12345

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 9:57 PM
bzimport set Reference to bz12345.
bzimport added a subscriber: Unknown Object (MLST).

410 is when you are sure the given page will no longer be served.
With lighttpd, the server does not even send the page content on a 410 error code.

Marking as wont fix :)

The patch for Article::getContent() if you ever want to try:

Index: includes/Article.php

  • includes/Article.php (revision 28716)

+++ includes/Article.php (working copy)
@@ -159,6 +159,12 @@

wfProfileOut( __METHOD__ );
$wgOut->setRobotpolicy( 'noindex,nofollow' );

+ if( $this->getTitle()->isDeleted() ) {
+ $wgOut->setStatusCode( 410 );
+ } else {
+ $wgOut->setStatusCode( 404 );
+ }
+

			if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
				$ret = wfMsgWeirdKey ( $this->mTitle->getText() ) ;
			} else {