Set noindex,nofollow on missing (404) pages
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 25 Jun 2014 04:28:50 +0000 (21:28 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 25 Jun 2014 04:28:50 +0000 (21:28 -0700)
* This used to be done until a0e83700a678dd813bf5173bac7f30e67d48c706 by mistake

Change-Id: I77c96363e472c5cb87183ba7d6458241b76d8ed1

includes/page/Article.php

index 967ca07..8a72815 100644 (file)
@@ -1209,12 +1209,10 @@ class Article implements Page {
                        $this->getContext()->getRequest()->response()->header( "HTTP/1.1 404 Not Found" );
                }
 
-               if ( $validUserPage ) {
-                       // Also apply the robot policy for nonexisting user pages (as those aren't served as 404)
-                       $policy = $this->getRobotPolicy( 'view' );
-                       $outputPage->setIndexPolicy( $policy['index'] );
-                       $outputPage->setFollowPolicy( $policy['follow'] );
-               }
+               // Also apply the robot policy for nonexisting pages (even if a 404 was used for sanity)
+               $policy = $this->getRobotPolicy( 'view' );
+               $outputPage->setIndexPolicy( $policy['index'] );
+               $outputPage->setFollowPolicy( $policy['follow'] );
 
                $hookResult = wfRunHooks( 'BeforeDisplayNoArticleText', array( $this ) );