On this page
A Sitemap directive in robots.txt tells crawlers where to find a sitemap, but it does not prove that the URL works or contains the pages you intend to submit. This checklist shows you how to find the file, check each sitemap URL, and inspect the response.
Key Takeaways
- Find
robots.txtat the root of the exact site origin: scheme, hostname, and port matter. - Check every
Sitemap:URL for a successful response, sensible redirects, and the intended content—not just an HTTP status code. - A sitemap index points to other sitemap files; check those files too.
robots.txtgives crawlers instructions. It does not protect private content or guarantee indexing.
Find the robots.txt file
For https://www.example.com/products, the robots file is:
https://www.example.com/robots.txt
The path is always /robots.txt at the origin root, not under /products. Check each relevant origin separately: http://example.com, https://example.com, and https://www.example.com are different origins. A non-default port is also part of the origin.
Open the URL in a browser first. For a more detailed check, run the following in a terminal, replacing the example URL with your own. It writes a local file named robots.txt, so use a working directory where overwriting that filename is safe.
curl -sS -L --max-redirs 5 --connect-timeout 10 --max-time 30 \
-o robots.txt \
-w 'Final URL: %{url_effective}\nHTTP status: %{http_code}\nContent type: %{content_type}\n' \
'https://www.example.com/robots.txt'
Check that the final status is 200, the final URL is expected, and the downloaded file contains the intended plain-text robots rules rather than an error page. The command follows redirects; an unexpected redirect can mean you are checking a different origin or a generic website page.
Advertisement
Check each robots.txt sitemap URL
Look in the downloaded file for lines such as:
User-agent: *
Disallow: /internal-search/
Sitemap: https://www.example.com/sitemap.xml
Sitemap: https://www.example.com/news-sitemap.xml
A file can list more than one sitemap. Check every Sitemap: line, including directives elsewhere in the file. Use an absolute URL, including the scheme and hostname. A sitemap directive advertises a location; it does not override applicable crawl rules.
For each URL, work through this checklist:
- Check the address. Look for misspellings, an old hostname, an unintended staging domain, or a missing scheme. Use the URL you actually intend crawlers to discover.
- Request it and inspect redirects. A redirect may be intentional, but verify that its final destination is correct and publicly accessible.
- Check the final status. Investigate
404,403,429, and server errors. A200is necessary for the straightforward case, but it does not establish that the response is a sitemap. - Inspect the body. Confirm that it is the intended sitemap, not an HTML login, bot-challenge, error, or homepage response. Check the hostname, paths, and sample page URLs.
- Check freshness and scope. Compare representative entries with your current public, canonical URLs. Investigate stale URLs, unintended staging URLs, and entries that redirect or return errors.
- If it is a sitemap index, check its children. Open representative child sitemap URLs and confirm that they are accessible and contain the expected pages. For a comprehensive audit, check each child.
This command saves the response for inspection. Replace the URL and avoid overwriting a local file you need:
curl -sS -L --max-redirs 5 --connect-timeout 10 --max-time 30 \
-o sitemap-response.xml \
-w 'Final URL: %{url_effective}\nHTTP status: %{http_code}\nContent type: %{content_type}\n' \
'https://www.example.com/sitemap.xml'
Review the reported status and final URL before trusting the saved file. A response content type can be a useful clue, but inspect the body too: a server can label an error page incorrectly. To diagnose a redirect chain or response headers, request headers separately:
curl -sS -I -L --max-redirs 5 --connect-timeout 10 --max-time 30 \
'https://www.example.com/sitemap.xml'
This uses a HEAD request. Some servers handle HEAD differently from GET, so compare it with the downloaded response if the results disagree. Likewise, your browser or curl may receive a different response from a search-engine crawler because of bot controls or caching. Check server logs and the search engine's reporting tools if results differ.
Confirm the sitemap content
For an XML sitemap, the root element is normally urlset; for an XML sitemap index, it is sitemapindex. An index contains locations of sitemap files, not necessarily individual page URLs. Check that the XML namespace and entries are appropriate, and examine enough entries to catch a wrong environment or outdated URL pattern.
If xmllint is installed and the response is uncompressed XML, you can check whether it is well-formed:
xmllint --noout sitemap-response.xml
No output normally means the file is well-formed XML. This does not prove it is a valid sitemap, that its URLs are reachable, or that search engines will accept or index them. A sitemap can also use a supported non-XML format; evaluate it according to that format rather than expecting an XML root element. If your sitemap is a compressed file, inspect it with an appropriate decompression tool before checking its contents.
Sitemap location and ownership rules can affect which URLs a search engine accepts, particularly for cross-host arrangements. Consult the relevant search engine's current sitemap documentation and verify ownership or submission requirements for your setup.
Advertisement
Common Mistakes
- Checking the wrong origin. A working file on the non-
wwwhost does not establish that thewwwhost has the intended file. - Stopping at
200 OK. A login page or branded error page can return a successful status. - Checking only the index. A sitemap index can load while one or more child files are broken or stale.
- Treating a sitemap as an indexing guarantee. Discovery through a sitemap does not guarantee crawling or indexing.
- Treating
robots.txtas access control. Its contents are publicly discoverable, and crawlers can ignore its instructions. Use authentication and authorization to protect private resources.
Best Practices
- Keep sitemap directives and their destinations aligned with the public production site.
- Recheck after hostname migrations, HTTPS changes, sitemap regeneration, or changes to CDN and bot-protection settings.
- Monitor both the robots file and sitemap endpoints for availability and unexpected redirects; investigate search-engine reports alongside server logs.
- Do not put secrets in
robots.txtor sitemap URLs. Avoid sending private URLs or credentials to third-party checking services.
Conclusion
To check a robots.txt sitemap URL, verify the file on the correct origin, follow each sitemap directive to its final response, and inspect the sitemap and any child files. A successful status is only the starting point.
Research limitation: current Google Search Central guidance and the robots exclusion protocol specification, RFC 9309, could not be retrieved for this article. Consult them directly for current crawler-specific behavior and protocol details before relying on version-sensitive guidance.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.