My link list has some URLs with www and some without. Which ones should I keep in the sitemap?

Keep the version your site really opens on, the one the other redirects to, and upload the sitemap to that same host. To the protocol, example.com and www.example.com are different hosts, and the URLs in one file should come from the host where the file lives. The tool counts the URLs per host and lets you keep one.

Published · 3 min read

Finding the right version

  1. Type your site address without www, such as example.com, into the browser and press Enter.
  2. Look at the address bar once the page opens: did it stay as typed, or switch to www.example.com?
  3. Try the reverse: type the www version.
  4. Wherever the browser ends up both times is the main version. That is the one to keep in the sitemap.

If both versions open without redirecting, your site serves the same content at two addresses. That is fixed in your hosting or domain panel, not in the sitemap, so ask whoever manages the hosting to redirect one to the other.

What the tool does with a mixed list

We pasted three URLs: page a on example.com, and pages b and c on www.example.com. A warning said the list contains two different hosts, and below it a 'URLs included in the file' menu offered:

  • All hosts (3)
  • https://www.example.com (2)
  • https://example.com (1)

While the menu stays on All hosts, a warning says the file still mixes more than one host. When we chose www.example.com, the valid count dropped to 2, the warning disappeared, and the file was ready to upload to that host.

The scheme counts too. In a second test we added a link starting with http://www.example.com, and it appeared as a third, separate host in the menu, because http and https are different addresses as far as the protocol is concerned.

Do not drop pages, fix their links

Choosing a host leaves the other host's URLs out of the file; it does not convert them. In our example page a fell out of the sitemap. If it is a real page you want listed, edit its line to https://www.example.com/a and it comes back under the right host.

  1. Paste the list into the XML sitemap generator and read the count for each host.
  2. Edit the lines on the wrong host so they use the main host.
  3. Pick the main host in the menu and check the warning has gone.
  4. Download the file and upload it to that host's root.

After uploading, write the Sitemap line in robots.txt with the full address on the same host, using the Robots.txt builder. The tool cannot know where you will upload the file and does not test the redirect between versions; that check is yours, in the browser.

Common questions

Is www or non-www better?

There is no meaningful difference. What matters is picking one, redirecting the other to it, and using it everywhere.

Does the tool rewrite links to the chosen host?

No, it only leaves the others out. Correct them in your list yourself.

Does letter case in the host matter?

No, the tool writes the host in lower case. The path after it keeps its case exactly.