如何从索引中的所有URL阻止搜索引擎使用origin.domainname.com开始 [英] How to block search engines from indexing all urls beginning with origin.domainname.com

查看:99
本文介绍了如何从索引中的所有URL阻止搜索引擎使用origin.domainname.com开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有www.domainname.com,origin.domainname.com指向同一个codeBase的。有没有一种方法,我可以prevent基名origin.domainname.com的所有URL从获得索引。

I have www.domainname.com, origin.domainname.com pointing to the same codebase. Is there a way, I can prevent all urls of basename origin.domainname.com from getting indexed.

是否有robot.txt的一些规则来做到这一点。这两个网址都指向了同一个文件夹。 此外,我试图重定向origin.domainname.com到www.domainname.com htaccess的文件,但它似乎没有工作..

Is there some rule in robot.txt to do it. Both the urls are pointing to the same folder. Also, I tried redirecting origin.domainname.com to www.domainname.com in htaccess file but it doesnt seem to work..

如果任何人谁已经有了类似的问题,可以帮助,我将不胜感激。

If anyone who has had a similar kind of problem and can help, I shall be grateful.

感谢

推荐答案

您可以重写的robots.txt 来的其他文件(让我们命名含有这种robots_no.txt

You can rewrite robots.txt to an other file (let's name this 'robots_no.txt' containing:

User-Agent: *
Disallow: /

(来源: http://www.robotstxt.org/robotstxt.html

.htaccess文件应该是这样的:

The .htaccess file would look like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^robots.txt$ robots_no.txt

使用定制的robots.txt每个(子)域:

Use customized robots.txt for each (sub)domain:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^sub.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.org$ [OR]
RewriteCond %{HTTP_HOST} ^example.org$
# Rewrites the above (sub)domains <domain> to robots_<domain>.txt
# example.org -> robots_example.org.txt
RewriteRule ^robots.txt$ robots_${HTTP_HOST}.txt [L]
# in all other cases, use default 'robots.txt'
RewriteRule ^robots.txt$ - [L]

不要问搜索引擎阻止对超过 www.example.com 其他页面,则可以使用所有页面的

&LT;链接相对= 规范&GT;

Instead of asking search engines to block all pages on for pages other than www.example.com, you can use <link rel="canonical"> too.

如果 http://example.com/page.html http://example.org/~example/page.html 都指向 http://www.example.com/page.html ,把下一个标签在&LT;头&GT;

If http://example.com/page.html and http://example.org/~example/page.html both point to http://www.example.com/page.html, put the next tag in the <head>:

<link rel="canonical" href="http://www.example.com/page.html">

参见谷歌的文章=规范

这篇关于如何从索引中的所有URL阻止搜索引擎使用origin.domainname.com开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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