为什么 web 协议设计有 :// 后缀?

Why are web protocols designed to have :// suffix?

在网络协议中://有什么意义?例如 ftp://http://

设计模式有什么原因吗?为什么不只是 http:http. 或类似 http~

任何对此文档的引用将不胜感激。

根据 Tim Berners-Lee 的说法,“在当时看来是个好主意”:

Sir Tim Berners-Lee, the creator of the World Wide Web, has confessed that the // in a web address were actually "unnecessary".

He told the Times newspaper that he could easily have designed URLs not to have the forward slashes.

"There you go, it seemed like a good idea at the time," he said.

He admitted that when he devised the web, almost 20 years ago, he had no idea that the forward slashes in every web address would cause "so much hassle".

http://news.bbc.co.uk/2/hi/technology/8306631.stm

看来没有什么特别的原因。

至于为什么他们在 Web 协议中这样做,它基于 the RFC that specifies URIs(第 3 节指定 URI 的基本语法)。 “//”在 URI 的基本语法之后直接解释为 hier-part = "//" authority path-abempty。至于他们为什么选择这些符号,我只能猜测这与传统有关(为什么'/'是unix/linux文件系统的根?)and/or对符号使用的熟悉程度.例如,在该 RFC 的顶部,我们看到 Request for Comments: 3986 表示该项目的类别是评论请求,属性 为 3986。

在写这篇文章时,@fschmengler 的回答似乎证实了这一点。

引自this site

The creator of the World Wide Web, Sir Tim Berners-Lee, has admitted that the double slash we see in every website address was a mistake, and that if he could go back and change things, it would be to remove this oblique double punctuation.

The British scientist according to the BBC News says that the double forward-slash is "pretty pointless", with:

"[t]yping in // has just resulted in people overusing their index fingers, wasting time and using more paper". The rest of the address is relatively important for the browser. Back in the "olden days" of the Internet, there were http protocols, gopher protocols and ftp protocols - and all followed with a colon and a double forward-slash. Now we have more protocols which are used, such as Skype and AIM to initiate a VoIP call or an instant message.

But there is practically no reference to the double forward-slash on the web, or as to why it is even there. In an interview with The Times of London, he could have easily redesigned URLs not to have the double forward-slashes in. Perhaps as a result, it would have reduced initial frustration, confusion over web addresses and saved on paper.

所以就像 fschmengler 所说的那样,没有真正的原因...

URL(统一资源定位器)是在 Web 中寻址页面的标准化方式。有两种基本类型的 URL:绝对和相对。它们在您网站的链接中都有自己的位置。

如果您想创建自定义 URI 方案,请查看此文档: https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx

如您所见,您不受双正斜杠的约束。还有 "mailto:" 呢,似乎并不是所有的协议都像您建议的那样遵守这种做法。看完你的问题后我找到了这个页面,希望你喜欢它:

http://webtips.dan.info/url.html