Uniform resource locator

From Wikipedia, the free encyclopedia
  (Redirected from URL)
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 (URL) (also called a web address)[1][2] is a reference to a resource that specifies the location of the resource on a computer network and a mechanism for retrieving it. A URL is a specific type of uniform resource identifier (URI),[3] although many people use the two terms interchangeably.[4] A URL implies the means to access an indicated resource, which is not true of every URI.[4][5] URLs occur most commonly to reference web pages (http), but are also used for file transfer (ftp), email (mailto), database access (JDBC), and many other applications.

Most web browsers display the URL of a web page above the page in an address bar. A typical URL has the form http://www.example.com/index.html, which indicates the protocol type (http), the domain name, (www.example.com), and the specific web page (index.html).

History[edit]

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

Berners-Lee later regretted the use of dots to separate the parts of the domain name within URIs, wishing he had used slashes throughout.[9], and also said that, given the colon following the first component of a URI, the two slashes before the domain name were also unnecessary.[10]

Syntax[edit]

Every HTTP URL conforms to the syntax of a generic URI. A generic URI is of the form:

scheme:[//[user:password@]domain[:port]][/]path[?query][#fragment]
  • The scheme consists of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. It is followed by a colon (:). Examples of popular schemes include http, ftp, mailto, file, and data. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.[11]
  • The hierarchical part, which contains:
    • An optional authority part, comprising:
    • A path, which contains data, usually organized in hierarchical form, that appears as a sequence of segments separated by slashes. Such a sequence may resemble or map exactly to a file system path, but does not always imply a relation to one.[12] The path must begin with a single slash (/) if an authority part was present, and may also if one was not, but must not begin with a double slash.
Query delimiter Example
Ampersand (&) key1=value1&key2=value2
Semicolon (;)[13] key1=value1;key2=value2
  • An optional query, separated from the preceding part by a question mark (?), containing a query string of non-hierarchical data. Its syntax is not well defined, but by convention is most often a sequence of attribute–value pairs separated by a delimiter.
  • An optional fragment, separated from the preceding part by a hash (#). The fragment contains a fragment identifier providing direction to a secondary resource, such as a section heading in an article identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an id attribute of a specific element, and web browsers will make sure this element is visible.

A web browser will usually dereference a URL by performing an HTTP request to the specified host, by default on port number 80. URLs using the https scheme require that requests and responses will be made over a secure connection to the website.

List of allowed URL characters[edit]

Unreserved[edit]

The alphanumerical upper and lower case character may optionally be encoded:

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

Special symbols must sometimes be percent-encoded:

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

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]

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.

URL protocols[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 of the 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.

Protocol-relative URLs[edit]

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.

Internationalized URL[edit]

Internet users are distributed throughout the world using a wide variety of languages and alphabets. Users expect to be able to create URLs in their own local alphabets.

An internationalized resource identifier (IRI) is a form of URL that includes Unicode characters. All modern browsers support IRIs. The parts of the URL requiring special treatment for different alphabets are the domain name and path.[18][19]

The domain name in the IRI is known as an internationalized domain name (IDN). Web and Internet software automatically convert the domain name into punycode usable by the Domain Name System.

For example, the Chinese web site http://見.香港 becomes the following for DNS lookup. xn-- indicates the character was not originally ASCII.[20]

http://xn--nw2a.xn--j6w193g/

The URL path name can also be specified by the user in the local alphabet. If not already encoded, it is converted to Unicode, and any characters not part of the basic URL character set are converted to English letters using percent-encoding.

For example, the following Japanese Web page http://domainname/引き割り.html becomes http://domainname/%E5%BC%95%E3%81%8D%E5%89%B2%E3%82%8A.html. The target computer decodes the address and displays the page.[18]

See also[edit]

Notes[edit]

References[edit]

  1. ^ http://www.collinsdictionary.com/dictionary/english/web-address
  2. ^ http://dictionary.reference.com/browse/web+address
  3. ^ 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"). 
  4. ^ a b RFC 3305
  5. ^ Skeet, Jon (6 Oct 2008). "What's the difference between a URI and a URL?". StackOverflow. Retrieved 4 September 2014. 
  6. ^ RFC 1738 Uniform Resource Locators (URL). This RFC is now obsolete. It has been superseded by a newer RFC (see the RFC Index)
  7. ^ "Living Documents BoF Minutes". W3.org. Retrieved 2011-12-26. 
  8. ^ "URL Specification". Retrieved 2011-12-26. 
  9. ^ a b Berners-Lee, Tim. "Frequently asked questions by the press". Retrieved 2010-02-03. 
  10. ^ "Technology | Berners-Lee 'sorry' for slashes". BBC News. 2009-10-14. Retrieved 2010-02-14. 
  11. ^ RFC 7595 describes the procedures for registering new URI schemes.
  12. ^ Berners-Lee, Tim; Fielding, Roy; Masinter, Larry (August 1998). "Uniform Resource Identifiers (URI): Generic Syntax". Internet Engineering Task Force. Retrieved 31 August 2015. 
  13. ^ RFC 1866, section 8.2.1, by Tim Berners-Lee in 1995, encourages CGI authors to support ';' in addition to '&'.
  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 (19 July 2011). "Protocol relative URLs enabled on test.wikipedia.org". blog.wikimedia.org. Archived from the original on 16 February 2014. Retrieved 16 February 2014. 
  16. ^ Brewster (25 October 2013). "Reader Privacy at the Internet Archive". blog.archive.org. Archived from the original on 16 February 2014. Retrieved 16 February 2014. 
  17. ^ Eric Lawrence (24 June 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. ^ a b "An Introduction to Multilingual Web Addresses". Retrieved 11 January 2015. 
  19. ^ "What is Happening with International URLs". Retrieved 11 January 2015. 
  20. ^ "Are chinese characters allowed in URLs?". Retrieved 11 January 2015. 

External links[edit]