Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1102351 of Identifying resources on the Web

  • Revision slug: Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
  • Revision title: Identifying resources on the Web
  • Revision id: 1102351
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment re-use some explanations from https://developer.mozilla.org/en-US/Learn/Common_questions/What_is_a_URL
Tags: 

Revision Content

{{HTTPSidebar}}

The target of an HTTP request is called a "resource", which nature isn't defined further; it can be a document, a photo, or anything else. Each resource is identified by a Uniform Resource Identifier ({{Glossary("URI")}}) used throughout HTTP for identifying resources.

URLs and URNs

URLs

The most common form of URI is the Uniform Resource Locator ({{Glossary("URL")}}), which is known as web address.

URLs look like these:

https://developer.mozilla.org
https://developer.mozilla.org/en-US/docs/Learn/
https://developer.mozilla.org/en-US/search?q=URL

Any of those URLs can be typed into your browser's address bar to tell it to load the associated page (resource).

A URL is composed of different parts, some mandatory and others optional.

https://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument

URNs

tbd

Syntax of Uniform Resource Identifiers (URIs)

Scheme or protocol

Protocol
https:// is the protocol. It indicates which protocol the browser must use. Usually it is the HTTP protocol or its secured version, HTTPS. The Web requires one of these two, but browsers also know how to handle other protocols such as mailto: (to open a mail client) or ftp: to handle file transfer, so don't be surprised if you see such protocols. Common schemes are:
Scheme Description
data Data URIs
file  
ftp  
http/https  
mailto  
ssh  
tel  
urn  
view-source  
ws/wss  

Authority

Domaine Name
www.example.com is the domain name or authority that governs the namespace. It indicates which Web server is being requested. Alternatively, it is possible to directly use an {{Glossary("IP address")}}, but because it is less convenient, it is not often used on the Web.

Port

Port
:80 is the port. It indicates the technical "gate" used to access the resources on the web server. It is usually omitted if the web server use the standard ports of the HTTP protocol (80 for HTTP and 443 for HTTPS) to grant access to its resources. Otherwise it is mandatory.

Path

Path to the file
/path/to/myfile.html is the path to the resource on the Web server. In the early days of the Web, a path like this represented a physical file location on the Web server. Nowadays, it is mostly an abstraction handled by Web servers without any physical reality.

Query

Parameters
?key1=value1&key2=value2 are extra parameters provided to the Web server. Those parameters are a list of key/value pairs separated with the & symbol. The Web server can use those parameters to do extra stuff before returning the resource. Each Web server has its own rules regarding parameters, and the only reliable way to know if a specific Web server is handling parameters is by asking the Web server owner.

Fragment

Anchor
#SomewhereInTheDocument is an anchor to another part of the resource itself. An anchor represents a sort of "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot. On an HTML document, for example, the browser will scroll to the point where the anchor is defined; on a video or audio document, the browser will try to go to the time the anchor represents. It is worth noting that the part after the #, also known as fragment identifier, is never sent to the server with the request.

Examples

https://developer.mozilla.org/en-US/docs/Learn
tel:+1-816-555-1212
[email protected]:mdn/browser-compat-data.git
ftp://example.org/resource.txt

 

Specifications

Specification Title
{{RFC("7230", "Uniform Resource Identifiers", "2.7")}} Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing

See also

Revision Source

<div>{{HTTPSidebar}}</div>

<p class="summary">The target of an HTTP request is called a "resource", which nature isn't defined further; it can be a document, a photo, or anything else. Each resource is identified by a Uniform Resource Identifier ({{Glossary("URI")}}) used throughout HTTP for identifying resources.</p>

<h2 id="URIs_URLs_and_URNs">URLs and URNs</h2>

<h3>URLs</h3>

<p>The most common form of URI is the Uniform Resource Locator ({{Glossary("URL")}}), which is known as <em>web address</em>.</p>

<p>URLs look like these:</p>

<pre>
https://developer.mozilla.org
https://developer.mozilla.org/en-US/docs/Learn/
https://developer.mozilla.org/en-US/search?q=URL</pre>

<p>Any of those URLs can be typed into your browser's address bar to tell it to load the associated page (resource).</p>

<p>A URL is composed of different parts, some mandatory and others optional.</p>

<pre>
https://www.example.com:80/path/to/myfile.html?key1=value1&amp;key2=value2#SomewhereInTheDocument</pre>

<h3>URNs</h3>

<p>tbd</p>

<h2 id="Uniform_Resource_Identifiers_(URIs)">Syntax of Uniform Resource Identifiers (URIs)</h2>

<h3 id="Scheme">Scheme or protocol</h3>

<dl>
 <dt><img alt="Protocol" src="https://mdn.mozillademos.org/files/8013/[email protected]" style="height:70px; width:440px" /></dt>
 <dd><code>https://</code> is the protocol. It indicates which protocol the browser must use. Usually it is the HTTP protocol or its secured version, HTTPS. The Web requires one of these two, but browsers also know how to handle other protocols such as <code>mailto:</code> (to open a mail client) or <code>ftp:</code> to handle file transfer, so don't be surprised if you see such protocols. Common schemes are:</dd>
</dl>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Scheme</th>
   <th scope="col">Description</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>data</td>
   <td>Data URIs</td>
  </tr>
  <tr>
   <td>file</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>ftp</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>http/https</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>mailto</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>ssh</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>tel</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>urn</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>view-source</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>ws/wss</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>

<h3 id="Authority">Authority</h3>

<dl>
 <dt><img alt="Domaine Name" src="https://mdn.mozillademos.org/files/8015/[email protected]" style="height:70px; width:440px" /></dt>
 <dd><code>www.example.com</code> is the domain name or authority that governs the namespace. It indicates which Web server is being requested. Alternatively, it is possible to directly use an {{Glossary("IP address")}}, but because it is less convenient, it is not often used on the Web.</dd>
</dl>

<h3 id="Path">Port</h3>

<dl>
 <dt><img alt="Port" src="https://mdn.mozillademos.org/files/8017/[email protected]" style="height:70px; width:440px" /></dt>
 <dd><code>:80</code> is the port. It indicates the technical "gate" used to access the resources on the web server. It is usually omitted if the web server use the standard ports of the HTTP protocol (80 for HTTP and 443 for HTTPS) to grant access to its resources. Otherwise it is mandatory.</dd>
</dl>

<h3>Path</h3>

<dl>
 <dt><img alt="Path to the file" src="https://mdn.mozillademos.org/files/8019/[email protected]" style="height:70px; width:440px" /></dt>
 <dd><code>/path/to/myfile.html</code> is the path to the resource on the Web server. In the early days of the Web, a path like this represented a physical file location on the Web server. Nowadays, it is mostly an abstraction handled by Web servers without any physical reality.</dd>
</dl>

<h4 id="Query">Query</h4>

<dl>
 <dt><img alt="Parameters" src="https://mdn.mozillademos.org/files/8021/[email protected]" style="height:70px; width:440px" /></dt>
 <dd><code>?key1=value1&amp;key2=value2</code> are extra parameters provided to the Web server. Those parameters are a list of key/value pairs separated with the <code>&amp;</code> symbol. The Web server can use those parameters to do extra stuff before returning the resource. Each Web server has its own rules regarding parameters, and the only reliable way to know if a specific Web server is handling parameters is by asking the Web server owner.</dd>
</dl>

<h3 id="Fragment">Fragment</h3>

<dl>
 <dt><img alt="Anchor" src="https://mdn.mozillademos.org/files/8023/[email protected]" style="height:70px; width:440px" /></dt>
 <dd><code>#SomewhereInTheDocument</code> is an anchor to another part of the resource itself. An anchor represents a sort of "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot. On an HTML document, for example, the browser will scroll to the point where the anchor is defined; on a video or audio document, the browser will try to go to the time the anchor represents. It is worth noting that the part after the #, also known as fragment identifier, is never sent to the server with the request.</dd>
</dl>

<h2 id="Examples">Examples</h2>

<pre>
https://developer.mozilla.org/en-US/docs/Learn
tel:+1-816-555-1212
[email protected]:mdn/browser-compat-data.git
ftp://example.org/resource.txt
</pre>

<p>&nbsp;
 <h2 id="Specifications">Specifications</h2>
</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Title</th>
  </tr>
  <tr>
   <td>{{RFC("7230", "Uniform Resource Identifiers", "2.7")}}</td>
   <td>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</td>
  </tr>
 </tbody>
</table>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Learn/Common_questions/What_is_a_URL">What is a URL?</a></li>
</ul>
Revert to this revision