Uniform Resource Locator

From The Hidden Wiki
Jump to navigationJump to search
File:URI Euler Diagram no lone URIs.svg
This Euler diagram shows that a uniform resource identifier (URI) is either a uniform resource locator (URL), or a uniform resource name (URN), or both.

A uniform resource locator (abbreviated URL; also known as a web address, particularly when used with HTTP) is a specific character string that constitutes a reference to a resource. Most web browsers display the URL of a web page above the page in an address bar. A typical URL might look like:

https://www.example.org/wiki/Main_Page

RFC 3986 (2005) classifies URLs as a specific type of uniform resource identifier (URI),<ref> Template:Cite web </ref> although many people use the two terms interchangeably.<ref name="rfc3305">RFC 3305</ref> A URL implies the means to access an indicated resource, which is not true of every URI.<ref name="rfc3305"/><ref name=uri-vs-url>Template:Cite web</ref> URLs occur most commonly to reference web pages (http), but can also have a role in file transfer (ftp), email (mailto), database access (JDBC), and many other applications (see URI scheme for a list).

URLs are specified in RFC 3986 (2005), and in a WHATWG URL Living Standard.<ref name="WHATWG Spec">Template:Cite web</ref>

History

The Uniform Resource Locator was standardized in 1994<ref name="RFC1738">Template:AnchorRFC 1738 Uniform Resource Locators (URL). This RFC is now obsolete. It has been superseded by a newer RFC (see the RFC Index)</ref> by Tim Berners-Lee and the URI working group of the Internet Engineering Task Force (IETF) as an outcome of collaboration started at the IETF Living Documents "Birds of a Feather" session in 1992.<ref name="Living Documents BoF Session Minutes">Template:Cite web</ref><ref name="URL Spec">Template:Cite web</ref> The format combines the pre-existing system of domain names (created in 1985) with file path syntax, where slashes are used to separate directory and file names. Conventions already existed where server names could be prepended to complete file paths, preceded by a double-slash (//).<ref name="TB-L,FAQ">Template:Cite web</ref>

Berners-Lee later regretted the use of dots to separate the parts of the domain name within URIs, wishing he had used slashes throughout.<ref name="TB-L,FAQ">Template:Cite web</ref> For example, https://www.example.com/path/to/name would have been written http:com/example/www/path/to/name. Berners-Lee has also said that, given the colon following the URI scheme, the two slashes before the domain name were also unnecessary.<ref name=slashes>Template:Cite web</ref>

Syntax

Template:Main Every HTTP URL consists of the following, in the given order. Several schemes other than HTTP also share this general format, with some variation.

  • the scheme name (commonly called protocol)
  • a colon, two slashes,<ref group="note">Berners-Lee has said that, given the colon following the URI scheme, the two slashes before the domain name were unnecessary.<ref name=slashes /> </ref>
  • a host, normally given as a domain name<ref group="note"> Berners-Lee also later regretted the use of dots to separate the parts of the domain name, wishing he had used slashes throughout. For example, https://www.example.com/path/to/name would have been written http:com/example/www/path/to/name<ref name="TB-L,FAQ"/> </ref> but sometimes as a literal IP address
  • optionally a colon followed by a port number
  • the full path of the resource

The scheme says how to connect, the host specifies where to connect, and the remainder specifies what to ask for.

For programs such as Common Gateway Interface (CGI) scripts, this is followed by a query string,<ref>RFC 1738</ref><ref name="parse_url">Template:Cite web</ref> and an optional fragment identifier.<ref name="Syntax">Template:Cite web</ref>

The syntax is:

scheme://domain:port/path?query_string#fragment_id

Component details:

  • The scheme, often referred to as protocol, defines how the resource will be obtained. Examples include http, https, ftp, file and many others. Although schemes are case-insensitive, the canonical form is lowercase.
  • The domain name or literal numeric IP address gives the destination location for the URL. A literal numeric IPv6 address may be given, but must be enclosed in [ ] e.g. [db8:0cec::99:123a].
    The domain google.com, or its numeric IP address 173.194.34.5, is the address of Google's website.
  • The domain name portion of a URL is not case sensitive since DNS ignores case:
    https://en.example.org/ and HTTP://EN.EXAMPLE.ORG/ both open the same page.
  • The port number, given in decimal, is optional; if omitted, the default for the scheme is used.
    For example, https://vnc.example.com:5800 connects to port 5800 of vnc.example.com, which may be appropriate for a VNC remote control session. If the port number is omitted for an http: URL, the browser will connect on port 80, the default HTTP port. The default port for an https: request is 443.
  • The path is used to specify and perhaps find the resource requested. It is case-sensitive,<ref>
 Template:Cite web

</ref> though it may be treated as case-insensitive by some servers, especially those based on Microsoft Windows.

  • If the server is case sensitive and https://en.example.org/wiki/URL is correct, then https://en.example.org/WIKI/URL or https://en.example.org/wiki/url will display an HTTP 404 error page, unless these URLs point to valid resources themselves.
  • The query string contains data to be passed to software running on the server. It may contain name/value pairs separated by ampersands, for example
    ?first_name=John&last_name=Doe.
  • The fragment identifier, if present, specifies a part or a position within the overall resource or document.
    When used with HTML, it usually specifies a section or location within the page, and used in combination with Anchor Tags the browser is scrolled to display that part of the page.

The scheme name defines the namespace, purpose, and the syntax of the remaining part of the URL. Software will try to process a URL according to its scheme and context. For example, a web browser will usually dereference the URL https://example.org:80 by performing an HTTP request to the host at example.org, using port number 80.

Other examples of scheme names include https, gopher, wais, ftp. URLs with https as a scheme (such as https://example.com/) require that requests and responses will be made over a secure connection to the website. Some schemes that require authentication allow a username, and perhaps a password too, to be embedded in the URL, for example ftp://[email protected]. Passwords embedded in this way are not conducive to security, but the full possible syntax is

scheme://username:password@domain:port/path?query_string#fragment_id

Other schemes do not follow the HTTP pattern. For example, the mailto scheme only uses valid email addresses. When clicked on in an application, the URL mailto:[email protected] may start an e-mail composer with the address [email protected] in the To field. The tel scheme is even more different; it uses the public switched telephone network for addressing, instead of domain names representing Internet hosts.

List of allowed URL characters

Unreserved

May be encoded but it is not necessary

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 - _ . ~

Reserved

Have to be encoded sometimes:

! * ' ( ) ; : @ & = + $ Template:Not a typo / ? % # [ ]

Further details can for example be found in RFC 3986 and https://www.w3.org/Addressing/URL/uri-spec.html.

Relationship to URI

A URL is a URI that, in addition to identifying a web resource, provides a means of locating the resource by describing its "primary access mechanism (e.g., its network location)".<ref name="RFC 3986">Tim Berners-Lee, Roy T. Fielding, Larry Masinter. (January 2005). "Uniform Resource Identifier (URI): Generic Syntax". Internet Society. RFC 3986; STD 66.</ref>

Internet hostnames

Template:Main On the Internet, a hostname is a domain name assigned to a host computer. This is usually a combination of the host's local name with its parent domain's name. For example, en.example.org consists of a local hostname (en) and the domain name example.org. The hostname is translated into an IP address via the local hosts file, or the domain name system (DNS) resolver. It is possible for a single host computer to have several hostnames; but generally the operating system of the host prefers to have one hostname that the host uses for itself.

Any domain name can also be a hostname, as long as the restrictions mentioned below are followed. For example, both "en.example.org" and "example.org" can be hostnames if they both have IP addresses assigned to them. The domain name "xyz.example.org" may not be a hostname if it does not have an IP address, but "aa.xyz.example.org" may still be a hostname. All hostnames are domain names, but not all domain names are hostnames.

Protocol-relative URLs

The protocol, or scheme, of a URL defines how the resource will be obtained. Two common protocols on the web are HTTP and HTTPS. For various reasons, many sites have been switching to permitting access through both the HTTP and HTTPS protocols.<ref name="C4Wauto-4875918">Template:Cite web</ref><ref name="C4Wauto-5521934">Template:Cite web</ref> Each protocol has advantages and disadvantages, including for some users that one or the other protocol either does not function, or is very undesirable. When a link contains a protocol specifier it results in the browser following the link using the specified protocol regardless of the potential desires of the user. It is possible to construct valid URLs without specifying a protocol which are called protocol-relative links (PRL) or protocol-relative URLs. Using PRLs on a page permits the viewer of the page to visit new pages using whichever protocol was used to obtain the page containing the link. This supports continuing to use whichever protocol the viewer has chosen to use for obtaining the current page when accessing new pages.<ref>Template:Cite web (section "Troubleshooting Mixed Content with the F12 Developer Console")</ref>

An example of a PRL is //en.wikipedia.org/wiki/Main_Page which is created by removing the protocol prefix.

Modern usage

Major computer manufacturers such as Apple have begun to deprecate APIs that take local paths as parameters, in favour of using URLs.<ref>Template:Cite web</ref> This is because remote and local resources (via the file scheme) may both be represented using a URL, but may additionally provide a protocol (particularly useful for remote items) and credentials.

See also

Template:Div col

Template:Div col end

Notes

1 }}
     | references-column-width 
     | references-column-count references-column-count-{{#if:1|{{{1}}}}} }}
   | {{#if: 
     | references-column-width }} }}" style="{{#if: 
   | {{#iferror: {{#ifexpr: 1 > 1 }}
     | Template:Column-width
     | Template:Column-count }}
   | {{#if: 
     | Template:Column-width }} }} list-style-type: {{#switch: "note"
   | upper-alpha
   | upper-roman
   | lower-alpha
   | lower-greek
   | lower-roman = "note"
   | #default = decimal}};">
<references group="note"></references>

References

1 }}
     | references-column-width 
     | references-column-count references-column-count-{{#if:1|{{{1}}}}} }}
   | {{#if: 30em
     | references-column-width }} }}" style="{{#if: 
   | {{#iferror: {{#ifexpr: 1 > 1 }}
     | Template:Column-width
     | Template:Column-count }}
   | {{#if: 30em
     | Template:Column-width }} }} list-style-type: {{#switch: 
   | upper-alpha
   | upper-roman
   | lower-alpha
   | lower-greek
   | lower-roman = {{{group}}}
   | #default = decimal}};">
<references group=""></references>

External links

Template:Hypermedia Template:Use dmy dates