The file URI scheme is a URI scheme defined in RFC 8089, typically used to retrieve files from within one's own computer.
Previously, file URI scheme is specified in RFC 1630 and RFC 1738. The Internet Engineering Task Force (IETF) has published a series of draft documents obsoleting these RFCs. They say that they are trying to define "a syntax that is compatible with most extant implementations, while attempting to push towards a stricter subset of 'ideal' constructs." Doing so involves the deprecation of some less common or outdated constructs, some of which are described below. While they may work on some current systems, formulations that are not consistent with the standardization process going forward will not have the useful lifetime that others will. The drafts are not final, and should be consulted for up to date information.
A file URI takes the form of
where host is the fully qualified domain name of the system on which the path is accessible, and path is a hierarchical directory path of the form directory/directory/.../name. If host is omitted, it is taken to be "localhost", the machine from which the URL is being interpreted. Note that when omitting host, the slash is not omitted (while "file:///foo.txt" is valid, "file://foo.txt" is not, although some interpreters manage to handle the latter).
[RFC 3986] includes additional information about the treatment of ".." and "." segments in URIs.
The slash character (/), depending on its position, has different meanings within a file URL.
Here are two Unix examples pointing to the same /etc/fstab file: