產品 SEO 與 GEO 代理 付費廣告代理 網站代理 轉換代理
運作方式 方案 常見問題 部落格 預約通話

robots.txt 加 noindex:讓網頁一直留在 Google 裡的錯誤

更新於 · 閱讀約 4 分鐘

簡短回答 不要在同一個網頁上同時使用兩者。Google 必須檢索網頁才能讀到 noindex 標記,而 robots.txt 封鎖會阻止檢索,所以 Google 永遠看不到這個標記。網址可能繼續留在搜尋結果中,而且往往沒有說明。要移除網頁:刪除 robots.txt 規則,保留 noindex,讓 Google 重新檢索。

想把這些用在您的生意上?預約一次 30 分鐘的免費通話,一起聊聊。

預約通話

為什麼 robots.txt 加 noindex 會讓網頁留在 Google 裡

這兩條規則會互相抵銷。robots.txt 是放在網站根目錄的一個檔案,告訴搜尋引擎機器人可以造訪哪些網址。noindex 是寫在某個網頁裡(或寫在伺服器對該網頁的回應中)的一行指令,意思是「不要把我列入搜尋結果」。要讀到 noindex,Google 必須造訪這個網頁。造訪被封鎖,noindex 就永遠讀不到。Google 說得很直接:

"If the page is blocked by a robots.txt file or the crawler can't access the page, the crawler will never see the noindex rule, and the page can still appear in search results, for example if other pages link to it." (Google Search Central: Block Search indexing with noindex) 譯文:「如果網頁遭 robots.txt 檔案封鎖,或檢索器無法存取該網頁,檢索器就永遠看不到 noindex 規則,網頁仍可能出現在搜尋結果中,例如有其他網頁連結到它時。」

這條規則適用於所有索引指令,不只是 noindex:「If indexing or serving rules must be followed, the URLs containing those rules cannot be disallowed from crawling」(如果必須遵守索引或放送規則,就不能禁止檢索包含這些規則的網址)(Google Search Central:Robots 中繼標記規格)。

在 robots.txt 裡封鎖網頁,不就能把它從 Google 移除嗎?

不能。robots.txt 控制的是造訪,不是收錄。Google 稱它「not a mechanism for keeping a web page out of Google」(不是讓網頁不出現在 Google 中的機制)(Google Search Central:robots.txt 簡介)。如果其他網頁連結到一個被封鎖的網址,Google 不用開啟它也能把它列出來。您在搜尋中看到的會是:只有一個網址,下方沒有任何說明(同一頁面)。

我該用哪一個?

目標使用原因
不讓網頁出現在搜尋結果中只用 noindexGoogle 必須檢索網頁才能遵守它
不讓任何人看到私密內容密碼或登入Google 把密碼保護列為一種移除方法(Google Search Central)
不讓機器人造訪浪費檢索時間或增加伺服器負擔的網頁只用 robots.txt這是它的主要用途(Google Search Central)
不讓圖片、影片或音訊出現在 Google 中robots.txtGoogle 說這對媒體檔案有效(同一頁面)
今天就移除一個網頁先用 Search Console 的「移除」工具,再加 noindex該工具會「within a day」(在一天內)隱藏網頁;noindex 讓它永久生效(Google Search Central)

還有一個陷阱:把 `noindex` 寫在 robots.txt 裡。「Specifying the noindex rule in the robots.txt file is not supported by Google」(Google 不支援在 robots.txt 檔案中指定 noindex 規則)(Google Search Central)。

修正步驟,依序進行

  1. 刪除封鎖該網頁的 robots.txt 規則。 在 Wix、Blogger 等架站工具上,您可能無法直接編輯這個檔案;請改為尋找搜尋設定頁面(Google Search Central)。
  2. 保留網頁上的 noindex:在網頁的 head 區段加一個設為 `noindex` 的 robots 中繼標記,或使用 `X-Robots-Tag: noindex` 回應標頭。Google 說兩者「have the same effect」(效果相同)(Google Search Central)。
  3. 檢查 Google 看到了什麼。 在 Search Console 中對該網頁執行網址審查;Google 建議用它查看「the HTML that Googlebot received」(Googlebot 收到的 HTML)(同一頁面)。
  4. 在網址審查中要求重新檢索。 不這樣做的話,Google 說對於很少有網站連結的網頁,再次造訪「may take months」(可能需要幾個月)(同一頁面)。
  5. 等待網頁從搜尋結果中消失。 一旦 Google 讀到這個標記,就會移除網頁,「regardless of whether other sites link to it」(無論其他網站是否連結到它)(同一頁面)。
  6. 只有在必要時才重新加回 robots.txt 封鎖,而且要等網頁已經離開搜尋結果之後。從那之後 Google 會忽略 noindex,所以如果有新連結指向它,網頁可能會重新出現。

Search Console 會顯示什麼

「網頁索引狀態」報告會直接點出這個問題。已建立索引,但遭到 robots.txt 封鎖(Indexed, though blocked by robots.txt)表示 Google 沒有造訪網頁就把它收錄了。它的建議是:

"To avoid being indexed, remove the robots.txt block and use 'noindex'." (Search Console Help: Page indexing report) 譯文:「如要避免建立索引,請移除 robots.txt 封鎖並使用『noindex』。」

網址標示為「noindex」(URL marked 'noindex')是您刻意隱藏的網頁應有的狀態。其他每種狀態的意思,請看我們的網頁索引狀態指南。

範例

一個刪不掉的感謝頁

一家清潔公司幫「感謝預約」頁面加了 noindex,為了保險又在 robots.txt 裡封鎖它。幾個月後,這個頁面仍然出現在 Google 中,沒有任何說明。他們刪除了 robots.txt 中的那一行,要求重新檢索,Google 再次造訪後頁面就消失了。

一份舊價目表

一家診所 2024 年的價目表一直被 robots.txt 封鎖。Search Console 顯示「已建立索引,但遭到 robots.txt 封鎖」。解決方法是移除封鎖並加上 noindex;在等待期間,用「移除」工具可在一天內先把它隱藏起來。

常見問題

Google 能收錄一個從未檢索過的網頁嗎?

能。如果其他網頁連結到這個網址,Google 光憑這些連結就能把它列出來,通常幾乎沒有說明或完全沒有說明(Search Console 說明)。

我還要加 nofollow 嗎?

只有在您希望 Google 也忽略網頁上的連結時才需要。`noindex, nofollow` 可以一起使用(Google Search Central)。它不影響網頁是否被收錄。

加了 noindex 的網頁要多久才會消失?

要等 Google 下次檢索它之後。對於很少被連結的網頁,這可能需要幾個月,所以請在網址審查中要求重新檢索(Google Search Central)。

其他搜尋引擎會遵守 noindex 嗎?

Google 提到,「that don't support noindex」(不支援 noindex)的搜尋引擎仍可能顯示該網頁(Google Search Central)。真正私密的內容,請用密碼保護。

您的情況不同?

  • 不確定網頁到底有沒有被收錄? 先從 Search Console 基礎開始。
  • 要封鎖的是 AI 機器人,不是 Google 搜尋? 那是 robots.txt 的另一種選擇,有不同的取捨:封鎖 AI 檢索器。
  • 新網站上線後排名下降? 檢查是否有測試網站遺留的 robots.txt 封鎖:改版後流量下降。
  • 想找人稽核檢索和索引設定? 請看 SEO 與 GEO 代理。

繼續閱讀

下一篇Robots.txt 是什麼:怎麼運作,又做不到什麼robots.txt 檔案是什麼、每一行怎麼寫、哪條規則優先,以及它做不到的事:把網頁擋在 Google 之外、保護私密檔案、攔住惡意機器人。

自己動手

可檢索性檢查清單:讓 Google 能造訪到每個頁面小型企業網站的可檢索性檢查清單:用免費工具找出孤立頁面、robots.txt 封鎖、失效連結、重新導向鏈和伺服器錯誤。

問我們一個問題

一句話就夠了。我們會以電子郵件回覆。

出處

  1. Google Search Central: Block Search indexing with noindex
  2. Google Search Central: Introduction to robots.txt
  3. Google Search Central: Robots meta tag, data-nosnippet, and X-Robots-Tag specifications
  4. Google Search Central: Remove a page hosted on your site from Google
  5. Search Console Help: Page indexing report