說明文件

傳送一個 URL


如果要使用 HTTP 要求來傳送一個 URL (使用搜尋引擎提供的 URL 取代 ),將您的要求提交至以下 URL:

                https://<searchengine>/indexnow?url=url-changed&key=your-key
            
  • url-changed 是已新增、更新或刪除之網站的 URL。URL 必須是 URL 逸出和編碼,請確保您的 URL 符合 URI 的 RFC-3986 標準。
  • 您的索引鍵應為最少 8 個和最多 128 個的十六進位進位字元。索引鍵只能包含以下字元:小寫字元 (a-z)、大寫字元 (A-Z)、數字 (0-9) 和破折號 (-)。

例如,如果您要通知搜尋引擎 https://www.example.com/product.html 已更新,而您想要使用此索引鍵 您的 URL 將會是:

                https://<searchengine>/indexnow?url=https://www.example.com/product.html&key=
            

您可以使用瀏覽器、wget、curl 或您選擇的任何其他機制來提交 HTTP 要求。成功的要求將傳回 HTTP 200 回應碼;如果您接收到不同的回應,請確認您傳送的頻率不高、索引鍵和 URL 是否有效,然後重新傳送要求。HTTP 200 回應碼僅表示搜尋引擎已收到您的 URL。

傳送一組 URL


如果要使用 HTTP 要求來傳送一組 URL,將您的 POST JSON 要求提交至搜尋引擎提供的 URL。使用搜尋引擎的主機名稱取代

                POST /indexnow HTTP/1.1
                Content-Type: application/json; charset=utf-8
                Host: <searchengine>
                {
                  "host": "www.example.com",
                  "key": "",
                  "urlList": [
                      "https://www.example.com/url1",
                      "https://www.example.com/folder/url2",
                      "https://www.example.com/url3"
                      ]
                }
            

每個 post 最多可以傳送 10,000 個 URL,如果需要,可以混合使用 http 和 https URL。

您可以使用 wget、curl 或您選擇的其他機制來提交 HTTP 要求。成功的要求將傳回 HTTP 200 回應碼;如果您接收到不同的回應,請確認您的要求,如果一切正常,則重新傳送要求。HTTP 200 回應碼僅表示搜尋引擎已收到您的 URL 組合。

建議在新增、更新或刪除內容時自動傳送 URL,直到達到一定的限制;請參閱常見問題集中使用者產生內容的最佳做法。

透過索引鍵來驗證擁有權


如果要傳送 URL,您必須透過在主機內代管至少一個文字檔案來「證明」提交 URL 的主機之擁有權。一旦您將 URL 傳送至搜尋引擎,搜尋引擎將編目索引鍵檔案以驗證擁有權,並使用該索引鍵,直到您變更該索引鍵為止。僅有您和搜尋引擎才能知道索引鍵和檔案索引鍵位置。

我們提供兩種驗證擁有權的方法。

選項 1
在主機的根目錄中代管文字索引鍵檔案。

您必須代管一個 UTF-8 編碼的文字索引鍵檔案 {your-key}.txt,其中列出了您網站根目錄下檔案中的索引鍵。

例如,對於前述範例,您需要將在 https://www.example.com/.txt 中代管 UTF-8 索引鍵檔案,而此檔案必須包含索引鍵

選項 2
在您的主機中代管文字索引鍵檔案。

您還可以在同一主機內的其他位置代管一個至多個 UTF-8 編碼的文字索引鍵檔案,並且您必須使用 keyLocation 變數指定位置,以在每個 IndexNow 通知中告知搜尋引擎此文字索引鍵檔案的位置。

如果您傳送一個 URL,請將索引鍵檔案位置指定為 keyLocation URL 參數值。

                    https://<searchengine>/indexnow?url=http://www.example.com/product.html&key=&keyLocation=http://www.example.com/myIndexNowKey63638.txt
                

如果您傳送一組 URL,請將索引鍵檔案位置指定為 JSON 內容中的 keyLocation 變數。

                    POST /indexnow HTTP/1.1
                    Content-Type: application/json; charset=utf-8
                    Host: <searchengine>
                    {
                      "host": "www.example.com",
                      "key": "",
                      "keyLocation": "https://www.example.com/myIndexNowKey63638.txt",
                      "urlList": [
                          "https://www.example.com/url1",
                          "https://www.example.com/folder/url2",
                          "https://www.example.com/url3"
                          ]
                    }
                

在此選項 2 中,索引鍵檔案的位置決定了可包含在此索引鍵中的 URL 組合。位於 http://example.com/catalog/key12457EDd.txt 的索引鍵檔案可以包含開頭為 http://example.com/catalog/ 的任何 URL,但不可包含開頭為 http://example.com/help/ 的 URL。

在 http://example.com/catalog/sitemap.xml 中未被視為有效的 URL 包含:

可能不會考慮將選項 2 中未被視為有效的 URL 用於編製索引。強烈建議您使用選項 1 並將您的檔案索引鍵放置於網站伺服器的根目錄中。

Response format


HTTP Code
Response
Reasons
200
OK
URL submitted successfully
202
Accepted
URL received. IndexNow key validation pending.
400
Bad request
Invalid format
403
Forbidden
In case of key not valid (e.g. key not found, file found but key not in the file)
422
Unprocessable Entity
In case of URLs which don’t belong to the host or the key is not matching the schema in the protocol
429
Too Many Requests
Too Many Requests (potential Spam)

Requirement for search engines


Search engines adopting the IndexNow protocol agree that submitted URLs will be automatically shared with all other participating search engines. To participate, search engines must have a noticeable presence in at least one market or be closely linked to the search market and make a significant contribution to the number of url submissions. Learn more