技术/程序设计/非SEO的优缺点是WWW还是没有WWW? [英] Technical/Programming/Non-SEO Pros and Cons of WWW or no-WWW?

查看:106
本文介绍了技术/程序设计/非SEO的优缺点是WWW还是没有WWW?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于域名以及子域名,www或no-www的技术/编程/非SEO 利弊是什么?

What are technical/programming/non-SEO pros and cons of www or no-www, for domains as well as sub-domains?

来自Jeff Atwood的Twitter,网址为 http://twitter.com/codinghorror/status/1637428313:
后悔没有选择www,因为它会导致将cookie完整提交到所有子域.:("
这是什么意思?有博客文章或文章详细介绍吗?

From Jeff Atwood's twitter at http://twitter.com/codinghorror/status/1637428313 :
"sort of regretting the no-www choice because it causes full cookie submission to ALL subdomains. :("
What does this mean? Is there a blog post or article detailing this?

www还应考虑哪些其他特定问题及其原因. VS没有www.

更新:
在搜索有关此主题的更多信息时,我发现以下帮助(除了Laurence Gonsalves回答):

Update:
On searching for more info on this topic, I found following helpful ( in addition to Laurence Gonsalves answer ) :

  • Dropping the WWW Prefix
  • Impact on search results: Jivlain's and Isaac Lin's comments
  • Use Cookie-free Domains for Components
  • on StackOverflow : Should I default my website to www.foo or not?
  • on StackOverflow : When should one use a ‘www’ subdomain?

推荐答案

默认情况下,Cookie仅限于设置它们的URL的主机.因此,其他人可以看到在" http://example.com/foo.html 上设置的cookie "example.com"上的网页,但其他主机上的网页则没有,甚至没有子域.

Cookies are, by default, restricted to the host of the URL they were set on. So cookies set on "http://example.com/foo.html" can be seen by other pages on "example.com" but not pages on other hosts -- not even subdomains.

可以为cookie设置域属性,使其对更多主机可见.该域属性必须以点开头,并且必须是设置cookie的页面的主机名的后缀.在域属性为后缀的主机上的页面上(可能)可以看到使用domain属性设置的cookie.因此,如果Cookie的域属性是".example.com",那么它将在"www.example.com","forums.example.com","foo.bar.example.com"上可见,但不是"example.com".因此,如果您通过"example.com"提供网站的一部分,则不能制作对子域可见的Cookie,但是如果您始终使用子域,则可以制作所有子域都可以看到的Cookie.

It is possible to set a domain attribute for a cookie which can make it visible to more hosts. This domain attribute must start with a dot and must be a suffix of the hostname of the page setting the cookie. Cookies set with a domain attribute are (potentially) visible to pages on hosts for which the domain attribute is a suffix. So if a cookie's domain attribute is ".example.com" it'll be visible on "www.example.com", "forums.example.com", "foo.bar.example.com" but not "example.com". So if you serve part of your site from "example.com" you can't make cookies that are visible to subdomains, but if you always use subdomains then you can make cookies that all subdomains can see.

您可以在 RFC2965 .我还发现了 websiteGear文章,其中的解释很清楚.

You can find a very detailed but somewhat hard to read explanation of this in RFC2965. I also found a websiteGear article which has a pretty clear explanation.

这篇关于技术/程序设计/非SEO的优缺点是WWW还是没有WWW?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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