可以在 robots.txt 中使用相对站点地图 url 吗? [英] Can a relative sitemap url be used in a robots.txt?

查看:38
本文介绍了可以在 robots.txt 中使用相对站点地图 url 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 robots.txt 中为站点地图文件编写以下相对 URL 吗?

In robots.txt can I write the following relative URL for the sitemap file?

sitemap: /sitemap.ashx

或者我是否必须使用站点地图文件的完整(绝对)URL,例如:

Or do I have to use the complete (absolute) URL for the sitemap file, like:

sitemap: http://subdomain.domain.com/sitemap.ashx

为什么我想知道:

  • 我拥有一个新的博客服务 www.domain.com,它允许用户在 accountname.domain.com 上写博客.
  • 我使用通配符,因此所有子域(帐户)都指向:blog.domain.com".

在 blog.domain.com 中,我放置了 robots.txt 以让搜索引擎找到站点地图.但是,由于通配符,所有用户帐户共享相同的 robots.txt 文件.这就是我不能使用第二种选择的原因.现在我不能对 txt 文件使用 url 重写.(我猜以后版本的 IIS 可以处理这个问题?)

In blog.domain.com I put the robots.txt to let search engines find the sitemap. But, due to the wildcards, all user account share the same robots.txt file.Thats why I can't use the second alternative. And for now I can't use url rewrite for txt files. (I guess that later versions of IIS can handle this?)

推荐答案

根据官方 sitemaps.org 上的文档 它需要是一个完整的 URL:

According to the official documentation on sitemaps.org it needs to be a full URL:

您可以使用 robots.txt 文件指定站点地图的位置.为此,只需将以下行添加完整网址到站点地图:

You can specify the location of the Sitemap using a robots.txt file. To do this, simply add the following line including the full URL to the sitemap:

Sitemap: http://www.example.com/sitemap.xml

这篇关于可以在 robots.txt 中使用相对站点地图 url 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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