一个站点的多个域:别名还是重定向? [英] Multiple domains for one site: alias or redirect?

查看:26
本文介绍了一个站点的多个域:别名还是重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在建立多个站点,其中许多站点拥有多个域.问题是:我是否为域添加别名(使用 ServerAlias)还是我重定向请求?

I'm setting up a number sites right now and many of them have multiple domains. The question is: do I alias the domain (with ServerAlias) or do I Redirect the request?

显然,从可读性或脚本的角度来看,ServerAlias 更好/更容易.但是我听说如果所有内容都重定向到一个域,Google 会更喜欢它.这是真的?如果是这样,应该使用什么重定向代码?

Obviously ServerAlias is better/easier from a readability or scripting perspective. I have heard however that Google likes it better if everything redirects to one domain. Is this true? If so, what redirect code should be used?

常见的虚拟主机示例将有:

Common vhost examples will have:

ServerName example.net
ServerAlias www.example.net

这是错误的吗,除了 example2.net 和 www.example2.net 之外,www 是否也应该是重定向?或者 Google 是否足够聪明,以至于所有这些网站(或至少 www)都是同一个网站?

Is this wrong and should the www also be a redirect in addition to example2.net and www.example2.net? Or is Google smart enough to that all these sites (or at least the www) are the same site?

更新:需要别名的部分原因是它们要快得多.仅因为拨号用户使用(或未使用)www 就对其进行重定向会显着增加初始页面加载.

UPDATE: Part of the reasoning for wanting aliases is that they are much faster. A redirect for a dialup user just because they did (or didn't) use the www adds significantly to initial page load.

更新和回答:感谢 Paul 找到 Google 链接 指示我们通过不要使重复内容处罚的神话永久化来帮助您的网站管理员".但是请注意,这仅适用于同一站点上的内容,在文章中举例说明了www.example.com/skates.asp?color=black&brand=riedell 或 www.example.com/skates.asp?brand=里德尔&颜色=黑色".事实上,文章明确指出不要创建多个页面、子域或包含大量重复内容的域."

UPDATE and ANSWER: Thanks Paul for finding the Google link which instructs us to "help your fellow webmasters by not perpetuating the myth of duplicate content penalties". Note, however, this only applies to content ON THE SAME SITE, exemplified in the article with "www.example.com/skates.asp?color=black&brand=riedell or www.example.com/skates.asp?brand=riedell&color=black". In fact, the article explicitly says "Don't create multiple pages, subdomains, or domains with substantially duplicate content."

推荐答案

重定向更好,那么您的内容总会有一个规范域.我听说 Google 会惩罚托管相同内容的多个域,但我目前找不到相关来源(编辑,这是一篇文章,但从 2005 年开始,这是互联网时代的古老历史!) (不正确,请参阅下面的编辑)

Redirecting is better, then there is always one, canonical domain for your content. I hear Google penalises multiple domains hosting the same content, but I can't find a source for that at the moment (edit, here's one article, but from 2005, which is ancient history in Internet years!) (not correct, see edit below)

以下是重定向到规范域的一些 mod-rewrite 规则:

Here's some mod-rewrite rules to redirect to a canonical domain:

RewriteCond %{HTTP_HOST}   !^www\.foobar\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://www.foobar.com/$1 [L,R=permanent]

在决定将请求重定向到规范域之前,它会检查主机是否不是规范域 (www.foobar.com) 并检查是否实际指定了域.

That checks that the host isn't the canonical domain (www.foobar.com) and checks that a domain has actually been specified, before deciding to redirect the request to the canonical domain.

进一步编辑:这是文章直接来自马口 - 似乎这不是你想象的那么大的问题.请仔细阅读这篇文章,因为它区分了同一站点上的重复内容(如www.example.com/skates.asp?color=black&brand=riedell 和 www.example.com/skates.asp?brand=riedell&color=black") 并特别说明不要创建多个页面、子域或包含大量重复内容的域."

Further Edit: Here's an article straight from the horses mouth - seems it's not as big an issue as you might think. Please read this article CAREFULLY as it distinguishes between duplicate content on the same site (as in "www.example.com/skates.asp?color=black&brand=riedell and www.example.com/skates.asp?brand=riedell&color=black") and specifically says "Don't create multiple pages, subdomains, or domains with substantially duplicate content."

这篇关于一个站点的多个域:别名还是重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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