タイトル: エラー一覧 (sitemap.xml)
SEOタイトル: sitemap.xml エラー総合 — Incorrect namespace / unable to parse XML / URL not allowed
| この記事の要点 |
|
sitemap.xml の標準フォーマット
https://example.com/
2026-06-10
daily
1.0
エラー一覧
| エラー | 原因 | 対処 |
|---|---|---|
| Incorrect namespace | xmlns 誤り | 正しい URI に修正 |
| unable to parse XML | 構文エラー / BOM / 文字化け | UTF-8 (BOM無)、タグ閉じ |
| Empty sitemap | URL を 1 つ以上 | |
| URL not allowed | ドメイン / プロトコル不一致 | sitemap と同 host に |
| Tag mismatch | 未閉じ / 重複 タグ | XML Linter で検出 |
| Sitemap index too large | 50,000 URL / 50MB 超 | index 分割 |
| Invalid XML: too many tags | タグ重複 | 1 url 内に loc は 1 個 |
| Invalid date | lastmod 形式エラー | ISO 8601 (YYYY-MM-DD) |
| Compression error | gzip ヘッダ無し | Content-Encoding 設定 |
| HTTP 404 / 500 | そもそも sitemap.xml に到達できない | パス / 権限確認 |
1. Incorrect namespace
画像 / 動画 / ニュース sitemap は追加 namespace が必要:
https://example.com/post/1
https://example.com/img/1.jpg
2. Unable to parse XML
XML として読めない。よくある原因と検出方法:
| 原因 | 確認 |
|---|---|
| BOM 付き UTF-8 | head -c 3 sitemap.xml | xxd → ef bb bf |
| Shift_JIS / EUC-JP | file sitemap.xml |
| 未エスケープの &, < | amp ; → & に |
| 未閉じタグ | xmllint --noout sitemap.xml |
| 制御文字 | cat -v で表示 |
# 検証
xmllint --noout sitemap.xml
# OK なら何も出ない、NG なら行番号付きでエラー
# Schema 検証
curl -O https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
xmllint --schema sitemap.xsd --noout sitemap.xml
# BOM 削除(Linux/macOS)
sed -i '1s/^\xEF\xBB\xBF//' sitemap.xml
# Windows PowerShell で BOM 無し UTF-8 で出力
Get-Content sitemap.xml | Out-File -Encoding UTF8NoBOM sitemap.xml
3. URL not allowed
sitemap.xml に書かれた URL のドメインが、sitemap 自体のドメインと違う場合に出ます:
https://anotherdomain.com/page
http://www.example.com/page
http://example.com/page
https://example.com/page
4. Sitemap index too large
1 sitemap には50,000 URL まで / 非圧縮で 50 MB まで。超えるなら sitemap index で分割:
https://example.com/sitemap-posts-1.xml
2026-06-10
https://example.com/sitemap-posts-2.xml
2026-06-10
https://example.com/sitemap-products.xml
2026-06-10
5. lastmod の形式
2026-06-10
2026-06-10T12:34:56+09:00
2026-06-10T12:34:56Z
2026/06/10
令和8年6月10日
6. Content-Type / gzip 圧縮
# nginx
location = /sitemap.xml {
types { application/xml xml; }
default_type application/xml;
}
location = /sitemap.xml.gz {
types { application/gzip gz; }
default_type application/gzip;
add_header Content-Encoding gzip;
}# Apache .htaccess
AddType application/xml .xml
AddType application/gzip .gz
# gzip 配信の Content-Encoding 自動付与
Header set Content-Encoding "gzip"
7. Google Search Console での確認
- Search Console → 該当プロパティ → サイトマップ
- 新規 sitemap を追加 (例:
sitemap.xml) - ステータスを確認: 「成功」 / 「取得できませんでした」 / 「エラー」
- エラー内容を展開して該当 URL を確認
「取得できませんでした」はrobots.txt で sitemap を disallow していることが原因のことが多い。
# robots.txt
User-agent: *
Disallow: /admin/
# sitemap.xml は allow されている必要あり
Sitemap: https://example.com/sitemap.xml
8. IIS で Content-Type が正しくない
FAQ
Q: sitemap.xml は必須?
A: 必須ではないが、新規サイト / 動的に増えるサイト / リダイレクト多いサイトでは強く推奨。Google にクロールヒントを渡せる。
Q: sitemap を更新したら Google にすぐ反映される?
A: いいえ。クロール優先度はクロール頻度・サイトの権威性に依存。Search Console から「再送信」できますが即時反映ではない。
Q: priority や changefreq は意味ある?
A: Google はほぼ無視すると公式表明。lastmod は読まれる。priority/changefreq は省略してよい。