google-search - 在虚拟主机中禁用 robots.txt 中的子域索引
问题描述
我正在制作一个要在我的网站中使用的子域 ,例如:
example.com -测试.example.com
但我在单个机器人文件上使用,因为它只是一个虚拟子域
那么如何在我的机器人文件中启用 example.com 索引但同时禁用test .example.com
因为在搜索时我输入“联系我们”它会给出 example.com/contact-us 的结果并测试.example.com/contact-us
我只想显示 example.com 结果并且不索引test.example.com 以禁用其在搜索结果中的外观
所以我删除了谷歌搜索控制台中的链接,但我必须编辑 robots.txt
解决方案
robots.txt
为您的子域创建一个单独的test.example.com
,它test.example.com/robots.txt
的内容如下所示。
User-agent: *
Disallow: /
确保你有一个单独的,正常的example.com/robots.txt
。
推荐阅读
- laravel-5 - Laravel 5.0 Eloquent 3 级关系
- symfony-2.7 - Symfony 3 | JMSi18nRoutingBundle 排除 SonataMediaBundle 路由
- python - 如何使用uwsgi白名单命令
- c++ - 将包含向量和 cv::Mat 的结构存储到磁盘 - C++ 中的数据序列化
- c# - EF Code First - 从 Azure 门户运行更新数据库
- ios - Swift:每次出现 tableview 时如何重新加载新内容(例如数组)?
- mysql - SQL 异常:当查询中没有这样的列时找不到列
- java - Eclipse AbstractTextEditor 不可编辑
- spring - @Cacheable注解的value和cacheName参数的区别
- android - 在apk逆向工程中隐藏res文件夹