Website is redirected to remove the
www.example.com is redirecting to
Question is do I need to include the
www in the sitemap for the robots.txt?
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
In your situation, Don't include "www" because web crawlers that do read the sitemap directive from your robots.txt will attempt to access the "www" version of your sitemap and then be redirected to the non-www version of the URL.
Not only will you be wasting a couple extra bytes by including "www", but the crawlers that parse the sitemap directive properly will be making two requests to your server: one for the www version, and one for the non-www version.