什么时候应该使用“www"子域? [英] When should one use a 'www' subdomain?

查看:49
本文介绍了什么时候应该使用“www"子域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几年浏览互联网时,我看到越来越多的网页去掉了www"子域.

When browsing through the internet for the last few years, I'm seeing more and more pages getting rid of the 'www' subdomain.

是否有充分的理由使用或不使用www"子域?

Are there any good reasons to use or not to use the 'www' subdomain?

推荐答案

有很多很好的理由来包含它,其中最好的在这里:雅虎性能最佳实践

There are a ton of good reasons to include it, the best of which is here: Yahoo Performance Best Practices

由于 cookie 的点规则,如果您没有www".那么你就不能像 *.example.com 那样设置两点 cookie 或跨子域 cookie.有两个相关的影响.

Due to the dot rule with cookies, if you don't have the 'www.' then you can't set two-dot cookies or cross-subdomain cookies a la *.example.com. There are two pertinent impacts.

首先,这意味着您向其提供 cookie 的任何用户都会将这些 cookie 与与域匹配的请求一起发回.因此,即使您有一个子域,images.example.com,example.com cookie 也将始终与请求一起发送到该域.如果您将 www.example.com 设为权威名称,则这会产生开销.当然,您可以使用 CDN,但这取决于您的资源.

First it means that any user you're giving cookies to will send those cookies back with requests that match the domain. So even if you have a subdomain, images.example.com, the example.com cookie will always be sent with requests to that domain. This creates overhead that wouldn't exist if you had made www.example.com the authoritative name. Of course you can use a CDN, but that depends on your resources.

此外,您将无法设置跨子域 cookie.这似乎很明显,但这意味着允许经过身份验证的用户在您的子域之间移动更多的是一项技术挑战.

Also, you then don't have the ability to set a cross-subdomain cookie. This seems evident, but this means allowing authenticated users to move between your subdomains is more of a technical challenge.

所以问自己一些问题.我设置cookie吗?我是否关心潜在的不必要的带宽支出?经过身份验证的用户会跨越子域吗?如果您真的担心给用户带来不便,您可以随时将服务器配置为自动处理 www/no www 的事情.

So ask yourself some questions. Do I set cookies? Do I care about potentially needless bandwidth expenditure? Will authenticated users be crossing subdomains? If you're really concerned with inconveniencing the user, you can always configure your server to take care of the www/no www thing automatically.

参见 dropwww是-www.

这篇关于什么时候应该使用“www"子域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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