Uniform resource locator

From Wikipedia, the free encyclopedia - View original article

  (Redirected from Uniform Resource Locator)
Jump to: navigation, search
"URL" redirects here. For other uses, see URL (disambiguation).
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:


RFC 3986 (2005) classifies URLs as a specific type of uniform resource identifier (URI),[1] although many people use the two terms interchangeably.[2] A URL implies the means to access an indicated resource, which is not true of every URI.[2][3] 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.[4]


The Uniform Resource Locator was standardized in 1994[5] 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.[6][7] 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 (//).[8]

Berners-Lee later regretted the use of dots to separate the parts of the domain name within URIs, wishing he had used slashes throughout.[8] For example, http://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.[9]


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 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,[10][11] and an optional fragment identifier.[12]

The syntax is:


Component details:

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 http://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://asmith@ftp.example.org. Passwords embedded in this way are not conducive to security, but the full possible syntax is


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:bob@example.com may start an e-mail composer with the address bob@example.com 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[edit]


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
0 1 2 3 4 5 6 7 8 9 - _ . ~


Have to be encoded sometimes:

! * ' ( ) ; : @ & = + $ , / ? % # [ ]

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

Relationship to URI[edit]

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)".[14]

Internet hostnames[edit]

Main article: Hostname

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[edit]

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.[15][16] 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.[17]

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

Modern usage[edit]

Major computer manufacturers such as Apple have begun to deprecate APIs that take local paths as parameters, in favour of using URLs.[18] 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[edit]


  1. ^ Berners-Lee has said that, given the colon following the URI scheme, the two slashes before the domain name were unnecessary.[9]
  2. ^ 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, http://www.example.com/path/to/name would have been written http:com/example/www/path/to/name[8]


  1. ^ Berners-Lee, T.; Fielding, R. (January 2005). "Uniform Resource Identifier (URI): Generic Syntax". www.ietf.org. Network Working Group. Retrieved 2014-09-05. "The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network "location")." 
  2. ^ a b RFC 3305
  3. ^ Skeet, Jon (6 Oct 2008). "What's the difference between a URI and a URL?". StackOverflow. Retrieved 4 September 2014. 
  4. ^ "URL Living Standard". 2014-04-11. Retrieved 2014-04-13. 
  5. ^ RFC 1738 Uniform Resource Locators (URL). This RFC is now obsolete. It has been superseded by a newer RFC (see the RFC Index)
  6. ^ "Living Documents BoF Minutes". W3.org. Retrieved 2011-12-26. 
  7. ^ "URL Specification". Retrieved 2011-12-26. 
  8. ^ a b c Berners-Lee, Tim. "Frequently asked questions by the press". Retrieved 2010-02-03. 
  9. ^ a b "Technology | Berners-Lee 'sorry' for slashes". BBC News. 2009-10-14. Retrieved 2010-02-14. 
  10. ^ RFC 1738
  11. ^ "PHP parse_url() Function". Retrieved 2009-03-12. 
  12. ^ "URL Syntax". Pangea.stanford.edu. 2004-07-20. Retrieved 2011-12-26. 
  13. ^ "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax". Network Working group of the IETF. January 2005. p. 40. Retrieved 2013-04-24. "[...] the scheme and host are case-insensitive [...] The other generic syntax components are assumed to be case-sensitive unless specifically defined otherwise by the scheme [...]" 
  14. ^ Tim Berners-Lee, Roy T. Fielding, Larry Masinter. (January 2005). "Uniform Resource Identifier (URI): Generic Syntax". Internet Society. RFC 3986; STD 66.
  15. ^ Lane, Ryan (July 19, 2011). "Protocol relative URLs enabled on test.wikipedia.org". blog.wikimedia.org. Archived from the original on February 16, 2014. Retrieved February 16, 2014. 
  16. ^ Brewster (October 25, 2013). "Reader Privacy at the Internet Archive". blog.archive.org. Archived from the original on February 16, 2014. Retrieved February 16, 2014. 
  17. ^ Eric Lawrence (June 24, 2011). "Internet Explorer 9 Security Part 4: Protecting Consumers from Malicious Mixed Content". Retrieved 2014-06-25.  (section "Troubleshooting Mixed Content with the F12 Developer Console")
  18. ^ "Deprecated NSOPenPanel Methods". Apple Inc. Retrieved 7 October 2012. 

External links[edit]