seo - 多个域的 Robots.txt

标签 seo

每种语言我们都有不同的域

  1. www.abc.com
  2. www.abc.se
  3. www.abc.de

然后我们为每个网站准备了不同的 sitemap.xml。在 robots.txt 中,我想为每个域添加站点地图引用。

  1. 是否可以在单个 robots.txt 中为每个域引用多个站点地图?
  2. 如果有多个,它会选择哪个?

最佳答案

在所有域重定向和 www 到非 www 重定向之后,我在 .htaccess 中使用以下解决方案。

# Rewrite URL for robots.txt
RewriteRule ^robots\.txt$ robots/%{HTTP_HOST}.txt [L]

在您的根目录中创建一个名为 robots 的新目录。 创建一个文本文件,其中包含每个域的特定机器人信息。

  • /robots/abc.com.txt
  • /robots/abc.se.txt
  • /robots/abc.de.txt

关于seo - 多个域的 Robots.txt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11373376/

相关文章:

performance - 如何克服 "Specify image dimensions"gtmetrix 性能摘要消息?

用于动态 HTML 页面的 PHP 与 JavaScript

seo - JSON-LD Schema.org 事件信息未被拉入 Google

seo - Google Search Console 上的 Robots.txt 错误

seo - 数据库驱动的产品页面和 SEO 的影响

html - 我应该使用字体大小 : 0 for image links?

php - Yii clean url 带有 id 和 name

firebase - 如何使用 Cloud Functions for Firebase 为 SEO 预渲染页面?

html - 针对搜索引擎优化网站

SEO - 临时未发布的页面 - 要返回哪个 http 状态代码?