I want to ask why http://
contains two slashes is it just standard to make it URL or any logically meaning? and why file:///
contains three slashes?
file:///C:/a.html
I want to ask why http://
contains two slashes is it just standard to make it URL or any logically meaning? and why file:///
contains three slashes?
file:///C:/a.html
The authority component of a URI has to be preceded by
//
:This is also why not all URIs contain the double slash: because not all URIs have an authority component (e.g., URIs using the
mailto
scheme, thexmpp
scheme, etc.).If you wonder why the double slash instead of something else (or nothing) was chosen for (HTTP) URIs, see Tim Berners-Lee’s FAQ Why the //, #, etc? → What is the history of the //?
tl;dr: He copied the filename syntax which Apollo used.
By the way, he regrets that choice:
As mentioned in this superuser post:
In other words, referring to files in your computer is just like referring to files in localhost.