[Mediawiki-l] How to return HTTP 404 for a non-existent page?

Thomas Dalton thomas.dalton at gmail.com
Sat Apr 5 23:59:09 UTC 2008


On 05/04/2008, Javier Valcarce García <javier.valcarce at gmail.com> wrote:
> Some time ago, I ask this same question, the solution, given to me by
>  Platonides, was to change a line in the source code of MediaWiki 1.10
>
>  if ( 0 == $this->getID() ) {
>     wfProfileOut( __METHOD__ );
>     $wgOut->setStatusCode(404); // CHANGED
>
>
>  Now, I have MediaWiki 1.12, What are the lines I must change now? Why
>  not include permanently this feature in the main source code?

The one reason I can remember for not doing it be default is that IE
won't display 404 error pages if they are too short, it displays its
error page instead. A MediaWiki page ought to be long enough to avoid
that, though. There are also issues with whether an edit page for a
non-existent article should be a 404 or not (and that's what redlinks
link to).


More information about the MediaWiki-l mailing list