properly handle noindex pages
[phinde.git] / src / phinde / Fetcher.php
index b5644af1310d16f2dbe107b36e75d2b059d57868..5ea0cf24fd7b0f2d27389815756aad91bdce9372 100644 (file)
@@ -52,7 +52,7 @@ class Fetcher
             );
         }
 
-        $effUrl = $res->getEffectiveUrl();
+        $effUrl = Helper::removeAnchor($res->getEffectiveUrl());
         if ($effUrl != $url) {
             $this->storeRedirect($url, $effUrl);
             $url = $effUrl;
@@ -69,11 +69,11 @@ class Fetcher
 
     protected function storeRedirect($url, $target)
     {
-        $esDoc = new \stdClass();
+        $esDoc = Helper::baseDoc($url);
         $esDoc->status = (object) array(
-            'location' => $target
+            'location' => $target,
+            'findable' => false,
         );
-        $esDoc->url = $url;
         $this->storeDoc($url, $esDoc);
     }