重定向到不同的领域特定robots_(蓝色|粉红色).TXT在.htaccess:
<IfModule mod_write.c>
RewriteEngine on
# internal redirect to robots_blue.txt
RewriteCond %{HTTP_HOST} =www.blue.com
RewriteRule ^robots\.txt$ /robots_blue.txt [L]
# internal redirect to robots_pink.txt
RewriteCond %{HTTP_HOST} =www.pink.com
RewriteRule ^robots\.txt$ /robots_pink.txt [L]
# internal redirct to index_blue.php, rewrite internal only
RewriteCond %{HTTP_HOST} =www.blue.com
RewriteRule ^index\.php$ /index_blue.php [L] # or "... /index.php?site=blue"
# external permanent redirect of test.php to index.php if not www.blue.com
RewriteCond %{HTTP_HOST} !=www.blue.com
RewriteRule ^test\.php$ /index.php [L,R=301]
# internal redirect
RewriteCond %{HTTP_HOST} =www.pink.com
RewriteRule ^index\.php$ /index_pink.php [L]
robots_blue.txt,不www.blue.com抓取test.php的:
User-agent: *
Sitemap: http://www.blue.com/sitemap.xml
Disallow: /test.php
Disallow: ...
robots_pink.txt,爬行允许www.pink.com:
User-agent: *
Sitemap: http://www.blue.com/sitemap.xml
Disallow:
如果www.blue.com的Disallows与www.pink.com相同,请将robots_blue.txt作为robots.txt用于这两个域。如果www.pink.com中没有使用test.php,它应该可以工作。
但是,如果要在robots.txt中使用sitemap.xml,这应该是一个解决方案。