For most websites, an XML sitemap should not include any links to URLs that have a 301 or 302 redirect, are canonicalised to other pages, or pages you don’t want to be crawled or indexed.
In a typical setup, only pages with a 200 and indexable status should be included.
There may be some exceptions, though.
XML Sitemap Inclusion Rules
In some instances, such as after a migration, you might want to keep old URLs in the XML sitemap. Keeping the redirected URLs in the file can help the new ones get picked up faster as search engines follow the redirects.
It is also possible to use a temporary XML sitemap file containing the URLs you want to be crawled. This works if there are status codes you want to update, URLs being removed, and more.
You may also wish to add URLs with a 410 (gone) status code so that they drop out of the index faster.
What about a Standard Sitemap?
While those rules are completely valid, we recommend a different approach for most clients.
If you’re not going through a migration, and you don’t have any URLs that are being removed etc., please only include the following in your XML sitemap:
Always make sure you make the right decision for your XML sitemap to help search engines discover your content in the most efficient manner. If you’re unsure which route to go down, speak to us today, and we’ll help you as best as possible.