Python script audits sitemap URLs for broken links and redirect chains
A DEV Community article explains how sitemaps drift over time, leaving listed URLs that are deleted, redirected, or chained. It presents a standard-library Python tool that reads a sitemap or sitemap index and requests each URL without automatic redirect following. The script records every hop of each redirect chain and writes the results to a CSV for review. It flags error responses, redirects on listed URLs, long chains, loops, temporary redirects, and canonical mismatches. The author notes that the approach was tested on Python 3.13, and that the publisher is also behind two free tools mentioned at the end, which the script does not require.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in