What Is A URL
What Is A URL
What Is A URL
This article discusses Uniform Resource Locators (URLs), explaining what they are and how
they're structured.
Prerequisites: You need to first know how the Internet works, what a Web server is and the
concepts behind links on the web.
Objective: You will learn what a URL is and how it works on the Web.
Summary
With Hypertext and HTTP, URL is one of the key concepts of the Web. It is the mechanism used
by browsers to retrieve any published resource on the web.
URL stands for Uniform Resource Locator. A URL is nothing more than the address of a given
unique resource on the Web. In theory, each valid URL points to a unique resource. Such
resources can be an HTML page, a CSS document, an image, etc. In practice, there are some
exceptions, the most common being a URL pointing to a resource that no longer exists or that
has moved. As the resource represented by the URL and the URL itself are handled by the Web
server, it is up to the owner of the web server to carefully manage that resource and its associated
URL.
Active Learning
There is no active learning available yet. Please, consider contributing.
Deeper dive
Basics: anatomy of a URL
Here are some examples of URLs:
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. Let's see the most
important parts using the following URL:
http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInThe
Document
http is the protocol. The first part of the URL indicates which protocol the browser must use. A
protocol is a set method for exchanging or transferring data around a computer network. Usually
for websites 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.
www.example.com is the domain name. It indicates which Web server is being requested.
Alternatively, it is possible to directly use an IP address, but because it is less convenient, it is
not often used on the Web.
: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 uses 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/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.
?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.