Google Sitemaps で xrea の stats をみる
ふと,Google Sitemaps を使ってみることにした.
- https://www.google.com/webmasters/sitemaps/docs/en/faq.html
- 日本語訳: http://kotonoha.main.jp/2005/06/04google-sitemaps.html
stats というのは,Google ロボットのクロール状況などのレポートを表示する仕組みらしい.これを使うためには,まず verification を行う必要があるんだけど,verify のために Check Status というボタンをクリックすると,こんなことを言われる.
We've detected that your 404 (file not found) error page returns a status of 200 (OK) in the header.
xrea サーバって,リクエストされたファイルが存在しない時には専用の動的 Not Found ページにリダイレクトされるんだけど,そこでどうもコード 200 か何かを返してるようで,それが悪さをしているような気ガス.
そこで,
ErrorDocument 404 http://terai.xrea.jp/file_not_found.html
を参考にして .htaccess で ErrorDocument を設定してやる (上のサイトには 3 行のコードがあるが,1 行目だけで OK).ただし上の例は実はちょっとだけ間違ってて,URL をフルで書いてしまうと,リダイレクトコード (3xx) を返してしまい,問題の解決にならなかったりする.
- http://www.futomi.com/lecture/htaccess/error_document.html
- http://www.totalchoicehosting.com/forums/lofiversion/index.php/t22389.html
ErrorDocument 404 /file_not_found.html
とすれば OK.これで,verify に成功し,stat が見られるようになる.
Google Sitemap 自体についてはまた機会があれば.