从 Google 网站管理员工具获取站点地图是 HTML [英] Getting Sitemap is HTML from Google Webmaster Tool

查看:56
本文介绍了从 Google 网站管理员工具获取站点地图是 HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[智者注意:跳到最后一个编辑]

我有一个非常简单的 txt 站点地图(名为 sitemap.txt),如下所示:

I have a very simple txt sitemap (named sitemap.txt) that looks like this:

http://myDomain.com
http://myDomain.com/about.html
http://myDomain.com/faq.html
http://myDomain.com/careers.html

当我在网站管理员工具上加载它时,我得到:

When I load it up on webmaster tools I get:

站点地图是 HTML -您的站点地图似乎是一个 HTML 页面.请改用支持的站点地图格式

我尝试了一些替代方案(例如带或不带 www),但都没有成功.

I tried a few alternatives (such as with or without www) but no luck.

有人知道吗?

感谢任何帮助!

编辑:

我尝试使用 xml 站点地图并得到相同的错误,因此看起来服务器正在以 HTML 形式提供所有内容(正如 ceejayoz 正确建议的那样).现在的问题是... 我如何让 appspot 服务器以纯文本的形式提供文本服务?

I tried with an xml sitemap and getting the same error so it looks like the server is serving everything as HTML (as ceejayoz correctly suggests). Now the question is ... how do I get the appspot server to server text as plain text?

好的 - 我受够了并实现了一个 servlet 来为我的站点地图提供服务(我现在正在尝试使用 XML 和 TXT)明确地作为文本/纯文本.如果我手动调用 servlet 但仍然获取 Sitemap 是 HTML,则一切正常.不知道该往哪里砸!

Ok - I got fed up and implemented a servlet to serve my sitemaps (I am now trying with both XML and TXT) explicitly as text/plain. Everything works fine if I manually invoke the servlet but still getting Sitemap is HTML. I don't know where to bang my head!

我尝试使用 Firefox 插件验证内容类型 - 一切似乎都在出现预期(我将提供实际 URL 以便人们可以查看):

I tried to verify content-type with a firefox plugin - everything seems to be coming up as expected (I am putting the actual URL so that people can have a look):

http://wokheisandbox.appspot.com/sitemaps/sitemap.txt--> 内容类型:文本/纯文本http://wokheisandbox.appspot.com/sitemaps/sitemap.xml -->内容类型:application/xml

http://wokheisandbox.appspot.com/sitemaps/sitemap.txt --> Content-type: text/plain http://wokheisandbox.appspot.com/sitemaps/sitemap.xml --> Content-type: application/xml

使用我的 servlet(明确设置 text/plain):http://wokheisandbox.appspot.com/wokhei/serveSitemap?fileType=TXT --> 内容类型:文本/纯文本http://wokheisandbox.appspot.com/wokhei/serveSitemap?fileType=XML --> 内容类型:text/plain

With my servlet (setting text/plain explicitly): http://wokheisandbox.appspot.com/wokhei/serveSitemap?fileType=TXT --> Content-type: text/plain http://wokheisandbox.appspot.com/wokhei/serveSitemap?fileType=XML --> Content-type: text/plain

我从网站管理员工具中得到的仍然是 -->站点地图是 HTML.

All I get from webmaster tool still is -->Sitemap is HTML.

编辑:

我想我找到了原因 --> 我在 google 网站管理员工具上将我的网站注册为 http://mydomain.com 但该应用程序托管在映射到 http://myapp.appspot.com 的 appspot 上mydomain.com.如果我注册 http://myapp.appspot.com 一切正常(站点地图已验证).

I think I found out the reason --> I registered on google webmaster tools my site as http://mydomain.com but the app is hosted on appspot at http://myapp.appspot.com which is mapped to mydomain.com. If I register http://myapp.appspot.com everything works fine (sitemap validated).

这是个好消息,但它并不理想,因为我希望将 mydomain.com 编入索引......关于如何克服的任何想法?

This is good news but it's not ideal because I want mydomain.com to be indexed ... any idea about how to overcome?

推荐答案

听起来像是您的网络服务器将 .txt 文件作为 text/html 而不是 text/plain.

Sounds like your webserver is serving .txt files as text/html instead of text/plain.

对于 Apache,.htaccess 文件中的以下内容应该可以修复它:

For Apache, the following in a .htaccess file should fix it:

AddType text/plain .txt

这篇关于从 Google 网站管理员工具获取站点地图是 HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆