【问题标题】:sitemap.xml on Google App EngineGoogle App Engine 上的 sitemap.xml
【发布时间】:2014-02-26 04:02:28
【问题描述】:

我的 Google App Engine 网站有以下 yaml 文件。

application: <my-app-id>
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /sitemap.xml
  static_files: static/sitemap.xml
  upload: static/sitemap.xml

- url: /
  static_files: static/index.html
  upload: static/index.html

- url: /
  static_dir: static

当我使用本地服务器测试这个应用程序时,可以通过导航访问文件 sitemal.xml。

 http://localhost:8080/sitemap.xml

但是,当我部署应用程序时,导航到以下页面只会将我重定向到 index.html(无法下载 xml 文件)。

 http://<my-domain>.net/sitemap.xml
 http://www.<my-domain>.net/sitemap.xml

为什么本地版本的行为与部署的版本不同?我该怎么做才能使文件在已部署的版本中可用?

【问题讨论】:

  • yourdomain.net 是否会重定向到 www.yourdomain.net?

标签: google-app-engine web search-engine web-crawler yaml


【解决方案1】:

原来问题是由域重定向引起的。如果我直接访问应用程序,请通过以下方式。

http://<app-id>.appspot.com/

然后一切都很好。显然,域托管服务处理重定向的方式出现了问题。

【讨论】:

    【解决方案2】:

    Google App Engine doesn't support naked domains 很可能没有正确重定向。尝试通过:http://www.&lt;my-domain&gt;.net/sitemap.xml 访问它,看看是否有效。

    【讨论】:

    • 不,无论我使用或不使用 www 子域都没有区别。无论哪种方式,我都无法访问该文件。
    猜你喜欢
    • 2011-04-09
    • 2013-05-18
    • 2011-10-04
    • 2015-10-01
    • 2010-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多