the internet's box_

log / Technology / Web & sites

Part 3 of 3 in Event Beam · series 1 (Dec 2026, ongoing)
earlier: Giving a single-page app a real 404 page

· error log #seo #sitemap #robots-txt #spa #static-files

robots.txt Pointed at a Sitemap That Was Really the SPA

What happened

An automated change scoped to SEO turned up a quiet bug. The site's robots.txt pointed crawlers at a sitemap URL. That URL didn't return a sitemap. The request fell through to the single-page app and came back as the app's HTML page.

A crawler following robots.txt would have fetched an HTML page where it expected XML. Nothing errored, so it was easy to miss.

The fix

I added a static sitemap file that lists the home page. It's a plain file, so the host serves it directly and the app's fallback never gets involved.

Why it works

Single-page app hosting usually rewrites any unknown path to the app's HTML entry page. That's useful for client-side routing, but it means a missing file looks like a successful response. A real static file matches before the fallback rule, so the sitemap URL now returns actual XML.

The audit score improved noticeably, more than I had expected. The change was kept. The file exists, it's kept up to date, and it adds no real complexity.

The lesson I'm taking from this: when robots.txt names a URL, request that URL and check the content type. On an SPA, a 200 response doesn't prove the file exists.