2

In the screenshot of Google Search Console below, I am looking at my property at example.com/my-site.

The black scribble is my site at example.com/my-site, and the yellow is me attempting to link my sitemap at cdn-site.example/id/sitemap.xml. Linking this sitemap through a shared example.com/robots.txt has not worked, probably because there is a relatively unrelated site at example.com.

Is it possible to "Add a new sitemap" with an external file, is there anything I'm missing here?

If not, can I set my sitemap to .../my-site/sitemap.xml in GSC and place a redirect (301) there to my CDN sitemap? Or will Googlebot be upset about the 301?

enter image description here

3
  • Could you host your full sitemap at /my-site/sitemap.xml? External sitemaps are supposedly supported, but I've never seen anybody actually get them to work. Feb 1 at 8:40
  • I have the same problem (my site is foo.mydomain.com and my sitemap is on bar.mydomain.com). I didn't find any solutions for now. Feb 1 at 13:55
  • In my team the process for doing that is long, a redirect or GSC-centered fix would be much faster and more straightforward. And updating the sitemap build script to write to a local assets folder would also be complicated. –
    – James L.
    Feb 1 at 18:21

2 Answers 2

1

I created a server side redirect (301 I believe) at /my-site/sitemap.xml to cdn-site.example/id/sitemap.xml. Worked great!

1

I had a similar issue :

  • My website is : mywebsite.mycompany.com
  • My sitemap and sitemap index files are generated and uploaded every night on cdn.mycompany.com/sitemap

I couldn't add my sitemap index file cdn.mycompany.com/sitemap/sitemap.xml in the Google Search Console tool.

So I added this in my website Nginx configuration :

# Nginx configuration for mywebsite.mycompany.com
location /sitemap.xml {
    set $backend https://cdn.mycompany.com/sitemap/sitemap.xml;
    proxy_pass $backend;
    proxy_ssl_server_name on;
}

To get my sitemap index file accessible on mywebsite.mycompany.com/sitemap.xml. I didn't redirect the sitemap files (because I want to keep it simple and don't use rewrite rules if I can), so only my sitemap index is accessible on my website domain. My sitemap index file looks like this :

<!-- mywebsite.mycompany.com/sitemap.xml -->
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>https://cdn.mycompany.com/sitemap/sitemap-item-1.xml</loc>
        <lastmod>2022-02-24</lastmod>
    </sitemap>
    <!-- ... -->
</sitemapindex>

It seems to work in the Search Console : my URLs were discovered. But I don't see the sitemap files in the UI, probably because of the different domain. I sent a comment to Google with a screenshot, I'll post an update if I get a response.

Google Search Console - sitemap index with sitemaps on another domain


TLDR: If you use a sitemap index file, it seems that you don't need to add your sitemap files in your website domain, only the sitemap index file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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