URL stands for
Uniform Resource Locator or simpler
web address that locates a server “Website” or
A full structure for a
URI = scheme:[//authority]path[?query][#fragment]
Now Let’s understand each part of the url
A url scheme is the first part of the URL indicates which protocol the browser must use, also called
Most popular protocol is the
http protocol and its secure one the
https protocol, this protocol is usually for websites.
Here is the list of most popular protocols:
www stands for
World Wide Web and it can be optionally written or can be removed.
if removed, you’ll have to remove the
The host name usually is a website name i.e
google.com which points to some server
IP or a direct server
IP that hosts the software that will receive the request.
The port that is used in the server, if not set, the default is
Most of the time the port is not present in the url
After we set the host-name
and the port optionally, we can tell the server which
path we want to execute in the server.
facebook.com/home, here the
/home is the path that will receive the request.
It is an extra information that is send to the server and it’s optionally as well to be set in the url or not based on the server software requirements.
If the url contains a query string, it must first start with
? then we write key/value pairs like this:
Here our query string starts after the
? sign, which consist of:
We can add as many segments
parameters as we need by separating between the by
& between each parameter.
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 the fragment identifier, is never sent to the server with the request.
It means that we can set some informations to the browser to tell him we need to go/scroll down to the location of that path if exists in the document/web page.