网址中的 www 有什么意义?

发布于 2024-07-11 09:57:58 字数 1432 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

谁人与我共长歌 2024-07-18 09:57:58

历史课。

曾经有一段时间,Web 并未主导互联网。 具有域的组织(例如我的大学,aston.ac.uk)通常会为各种服务设置多个主机名:gopher.aston.ac.uk(Gopher 是万维网的前身)、news.aston .ac.uk(用于 NNTP Usenet)、ftp.aston.ac.uk(FTP - 包括匿名 FTP 存档)。 它们只是访问这些服务的明显名称。

当 HTTP 出现时,约定将 Web 服务器的主机名命名为“www”。 该约定如此广泛,以至于有些人开始相信“www”部分实际上告诉客户要使用什么协议。

这个惯例至今仍然很流行,而且确实有一定的道理。 但这在技术上不是必需的。

我认为 Slashdot 是最早决定使用不含 www 的 URL 的网站之一。 当新闻文章在他的 URL 中包含“www”时,他们的负责人 Rob Malda 提到了“TCWWW”——“被诅咒的 WWW”。 我想对于像 Slashdot 这样主要是一个网站的网站来说,URL 中的“www”是多余的。

您可以选择您喜欢的地址作为规范地址。 但一定要保持一致。 从其他形式重定向到规范形式是很好的做法。

History lesson.

There was a time when the Web did not dominate the Internet. An organisation with a domain (e.g. my university, aston.ac.uk) would typically have several hostnames set up for various services: gopher.aston.ac.uk (Gopher is a precursor to the World-wide Web), news.aston.ac.uk (for NNTP Usenet), ftp.aston.ac.uk (FTP - including anonymous FTP archives). They were just the obvious names for accessing those services.

When HTTP came along, the convention became to give the web server the hostname "www". The convention was so widespread, that some people came to believe that the "www" part actually told the client what protocol to use.

That convention remains popular today, and it does make some amount of sense. However it's not technically required.

I think Slashdot was one of the first web sites to decide to use a www-less URL. Their head man Rob Malda refers to "TCWWW" - "The Cursed WWW" - when press articles include "www" in his URL. I guess that for a site like Slashdot which is primarily a web site to a strong degree, "www" in the URL is redundant.

You may choose whichever you like as the canonical address. But do be consistent. Redirecting from other forms to the canonical form is good practice.

蓝海 2024-07-18 09:57:58

另外,跳过“www”。 每个请求可以节省四个字节。 :)

Also, skipping the “www.” saves you four bytes on each request. :)

記憶穿過時間隧道 2024-07-18 09:57:58

重要的是要注意,如果您不使用 www(或其他一些子域),那么所有 cookie 都将提交到每个子域,并且您将无法使用无 cookie 的子域来提供静态内容,从而减少浏览器和服务器之间来回发送的数据量。 有些事情你以后可能会后悔。

(另一方面,跨子域验证用户身份变得更加困难。)

It's important to be aware that if you don't use a www (or some other subdomain) then all cookies will be submitted to every subdomain and you won't be able to have a cookie-less subdomain for serving static content thus reducing the amount of data sent back and forth between the browser and the server. Something you might later come to regret.

(On the other hand, authenticating users across subdomains becomes harder.)

不如归去 2024-07-18 09:57:58

实际上,这只是一个基于传统的子域。 如果您不喜欢它,那就没有意义,而且还浪费打字时间。 对于我的网站,我更喜欢 http://somedomain.com 而不是 http://www.somedomain.com

It's just a subdomain based on tradition, really. There's no point of it if you don't like it, and it wastes typing time as well. I like http://somedomain.com more that http://www.somedomain.com for my sites.

荒芜了季节 2024-07-18 09:57:58

这主要是建立主机名间接的问题。 如果您希望能够更改 www.example.com 指向的位置而不影响 example.com 指向的位置,那么这一点很重要。 当网络还很年轻时,这可能更有用,并且“www”有助于明确该盒子存在的原因。 如今,许多域的存在主要是为了提供 Web 内容,example.com 记录了所有内容,但无论如何都必须指向 HTTP 服务器,因为人们会盲目地省略 www。 (就在本周,当我尝试访问某人提到的网站时,我感到很震惊,却发现当我省略 www 时,或者当我不小心在 TLD 后添加尾随点时,它不起作用。)

省略“www” “非常 Web 2.0 Adoptr Gamma...但有充分的理由。 如果人们只是为了网页内容而访问您的网站,为什么还要不断重新添加 www? 一般情况下,我会放弃它。

It's primarily a matter of establishing indirection for hostnames. If you want to be able to change where www.example.com points without affecting where example.com points, this matters. This was more likely to be useful when the web was younger, and the "www" helped make it clear why the box existed. These days, many, many domains exist largely to serve web content, and the example.com record all but has to point to the HTTP server anyway, since people will blindly omit the www. (Just this week I was horrified when I tried going to a site someone had mentioned, only to find that it didn't work when I omitted the www, or when I accidentally added a trailing dot after the TLD.)

Omitting the "www" is very Web 2.0 Adoptr Gamma... but with good reason. If people only go to your site for the web content, why keep re-adding the www? I general, I'd drop it.

以可爱出名 2024-07-18 09:57:58

http://no-www.org/

Google Analytics(分析)无论有没有 www 子域都应该可以正常工作,尽管。 许多成功使用 GA 的网站并不强制采用非此即彼的方式。

http://no-www.org/

Google Analytics should work just fine with or without a www subdomain, though. Plenty of sites using GA successfully that don't force either/or.

东京女 2024-07-18 09:57:58

它是第三级域名(参见域名< /a> 曾经一度指定物理服务器:一些网站使用 www1.foo.com、www3.foo.com 等 URL,

现在它更加虚拟(不同的三级域名指向相同的域名) 。服务器,相同的 URL 由不同的服务器处理),但它通常用于处理子域,并且通过一些技巧,您甚至可以处理无限数量的子域:准确地参见 Wikipedia,它使用此级别的语言(en.wikipedia.org、fr.wikipedia.org 等)或其他网站向其用户提供友好的 URL(例如我的页面 http://PhiLho.deviantART.com)。

所以 www. 不仅仅是为了装饰,它有一个目的,即使绝大多数网站只是坚持这个默认值,并且如果未提供,请自动提供。我知道有些网站会忘记重定向,如果您省略它,则会出现错误,而它们在无 www 的 URL 上进行通信:他们希望用户自动提供它!

It is the third-level domain (see Domain name. There was a time where it designated a physical server: some sites used URLs like www1.foo.com, www3.foo.com and so on.

Now, it is more virtual (different 3rd-level domains pointing to same server, same URL handled by different servers), but it is often used to handle sub-domains, and with some trick, you can even handle an infinite number of sub-domains: see, precisely, Wikipedia which uses this level for the language (en.wikipedia.org, fr.wikipedia.org and so on) or others site to give friendly URLs to their users (eg. my page http://PhiLho.deviantART.com).

So the www. isn't just here for decoration, it has a purpose, even if the vast majority of sites just stick to this default, and if not provided, supply it automatically. I knew some sites forgetting to redirect, giving an error if you omitted it, while they communicated on the www-less URL: they expected users to supply it automatically!

金橙橙 2024-07-18 09:57:58

更不用说 URL 已经指定了要使用的协议,所以“www”。 实在是没有什么用。

据我记得,以前像www和ftp这样的服务位于不同的机器上,因此此时使用自然的DNS功能(子域)是必要的(或多或少)。

Let alone the URL already specifies what protocol is to be used so "www." is really of no use.

As far as I remember, in former times services like www and ftp were located on different machines, therefore using the natural DNS features (subdomains) was necessary at this time (more or less).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文