How to Audit an XML Sitemap for Redirects and Wrong URLs

Clean Your Sitemap. A website analyst works at a monitor.

Published

A sitemap can load successfully while listing pages that redirect, return errors or tell search engines to index a different URL. A useful audit checks what each listed address actually does. Start with one child sitemap and a few pages you recently moved or retired.

Choose a small sample

Open your sitemap index and select a child file for one content type, such as product pages. Copy five URLs into a sheet. Add columns for the original response, final URL, declared canonical, indexing directive and intended outcome. An XML sitemap is a list of preferred URLs for search engines, so include the canonical addresses you want shown. Google’s sitemap documentation

A web editor checks notes on paper.
AI-generated editorial illustration by Qandey Tech.

Check the listed address before following redirects

For a URL you manage, run curl -sS -D - -o /dev/null 'https://example.com/products/oak-lamp/'. Read the status line and any Location or X-Robots-Tag header. This request shows the response at the listed address. If it returns a redirect, follow it with curl -sSL -o /dev/null -w '%{http_code} %{url_effective} %{num_redirects}\n' 'https://example.com/products/oak-lamp/'.

Open the destination and inspect its canonical tag and robots meta tag. A readable 200 page can still declare a different preferred URL or carry a noindex directive. Check the page content and URL in Search Console if you need to compare your declaration with Google’s selected canonical. Qandey Tech’s canonical inspection guide

Work through three sample rows

Imagine a shop lists an old lamp URL that sends a 301 to its renamed product. Keep the redirect for existing links and list the destination in the sitemap once it returns 200 and declares the intended canonical.

A second row is a tracking variant of a live collection URL. It returns 200 but declares the clean collection URL as canonical. List the clean URL. Leave the tracking link available where it has a reporting purpose.

A third row is a retired accessory with no equivalent. It returns a genuine 404. Remove it from the sitemap and fix any internal links that still send buyers there. If the same product now lives elsewhere, map the old address to its relevant successor first. Qandey Tech’s redirect audit

Two colleagues verify a web page on a laptop.
AI-generated editorial illustration by Qandey Tech.

Fix the generator and verify the next export

If your CMS generates the sitemap, identify which setting, publication state or field caused the entry. Fix that source so the next update does not reintroduce the old URLs. If a legitimate product temporarily goes out of stock and the page remains useful and indexable, it can stay listed.

Fetch the regenerated XML, confirm the intended URLs are present and recheck the same sample. Record the date and send the updated sitemap through Search Console if it is a new submission or needs resubmitting. A successful sitemap submission confirms Google can process the file. Check the individual URLs over time to see how indexing follows. Google’s sitemap documentation

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *