12

I have the schema with this:

<sitemapindex xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">

Is it correct or should be:

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

if all my web pages are on HTTPS?

3 Answers 3

10

The value of the xmlns attribute is to uniquely identify a namespace (the "namespace URI"). It does not relate to whether your site is serving content over HTTP or HTTPS - for this it makes no difference.

The sitemaps.org site defines the protocol using http://www.sitemaps.org/schemas/sitemap/0.9 as the recognised namespace - so this should really be the string used.

(However, sitemaps.org does universally redirect everything to HTTPS, so maybe both would seem to be valid? But see @unor's comment below.)

3
  • 2
    "[…] so both would seem to be valid?" -- I don’t think so. xmlns values act as identifiers, the URIs don’t necessarily get retrieved (which is sometimes not even possible).
    – unor
    Commented Aug 25, 2017 at 22:21
  • 1
    Yes, it's essentially an identifier. Google accepts both, since people tend to use them interchangeably nowadays. That said, there are no HTTP or HTTPS requests made to that URL when a sitemap file is processed, so in practice it doesn't affect security at all. Commented Aug 29, 2017 at 20:29
  • 1
    This is an example of a URL used as a URN (name). If you change it to HTTPS, it loses its defined meaning. See What is the difference between a URI, URL, and URN Commented Apr 27, 2018 at 15:04
7

You can validate your sitemap on https://www.google.com/webmasters/tools. It will give an error when you use https to refer to the schema.

I have also seen other sitemap validators that refuse to validate the https version of the namespace, so using http might be the only correct option, even when your site only uses https.

2
  • 1
    However GSC (formerly Google Webmaster Tools) does not give an error when using https for the sitemap namespace URI. (?)
    – DocRoot
    Commented Aug 24, 2017 at 0:02
  • I found an error using google webmaster tools because of the https.So I found the tool and the answer the best. Commented Aug 24, 2017 at 6:55
1

Just has similar problem with this a I want to confirm what 'DocRoot' say. Google Search Console did not recognize version with 'https' but I changed that to version with 'http' and everything works (google shows sitemap is valid)

So

incorrect: https://www.sitemaps.org/schemas/sitemap/0.9

correct: http://www.sitemaps.org/schemas/sitemap/0.9

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.