How is a URL structured?

A huge part of modern software is related to web technologies, mostly done by a web server interpreting a URL (Uniform Resource Locator) to locate a resource. In this short writing we will learn how a URL is structured and interpreted.

URL Ex…


This content originally appeared on DEV Community and was authored by Christian Paez

A huge part of modern software is related to web technologies, mostly done by a web server interpreting a URL (Uniform Resource Locator) to locate a resource. In this short writing we will learn how a URL is structured and interpreted.

URL Example

https://example.com:443/path/file.html?key1=value1&key2=value2#SomeLocationInDocument

A URL like this one is divided into multiple components:

Scheme (Required)

Image description

Indicates the protocol that has to be used to request the resource, can be either https (With SSL/Secure) or http (Without SSL/Unsecure).

User (Optional)

Image description

Used for HTTP Basic Authentication, currently deprecated since it is prone to security flaws, is written in the form user:password followed by an @ sign.

Host (Required)

Image description

This is the resource location, could be an IP address (e.g., 192.0.2.146) or a host name (e.g., example.com). a host name can include a subdomain followed by a dot . before the domain name (i.e., subdomain.example.com) and has to include a top-level domain (e.g., .com).

Port (Optional)

Image description

This number indicates the web server port number we want to connect to, denoted after the host and preceded by colon : defaults to 443 for https and 80 to http.

Path/Directory (Optional)

Image description

Points to the resource we want to access, can be a file or a folder; all web applications have a default path, usually index.html.

Query String (Optional)

Image description

These are extra parameters sent to the web server, starts with a question mark ?
followed by one or many key value pairs in the form key=value.

Fragment/Anchor (Optional)

Image description

This is used by the locate sections within the document displayed by the browser; this value is only processed on the client.

As you can see, there is a lot going on in a URL string, we hope this short writing can provide useful info as to what these values mean.

Check this post on Art Of Code: https://artofcode.tech/how-is-a-url-structured/


This content originally appeared on DEV Community and was authored by Christian Paez


Print Share Comment Cite Upload Translate Updates
APA

Christian Paez | Sciencx (2022-06-24T01:08:21+00:00) How is a URL structured?. Retrieved from https://www.scien.cx/2022/06/24/how-is-a-url-structured/

MLA
" » How is a URL structured?." Christian Paez | Sciencx - Friday June 24, 2022, https://www.scien.cx/2022/06/24/how-is-a-url-structured/
HARVARD
Christian Paez | Sciencx Friday June 24, 2022 » How is a URL structured?., viewed ,<https://www.scien.cx/2022/06/24/how-is-a-url-structured/>
VANCOUVER
Christian Paez | Sciencx - » How is a URL structured?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/06/24/how-is-a-url-structured/
CHICAGO
" » How is a URL structured?." Christian Paez | Sciencx - Accessed . https://www.scien.cx/2022/06/24/how-is-a-url-structured/
IEEE
" » How is a URL structured?." Christian Paez | Sciencx [Online]. Available: https://www.scien.cx/2022/06/24/how-is-a-url-structured/. [Accessed: ]
rf:citation
» How is a URL structured? | Christian Paez | Sciencx | https://www.scien.cx/2022/06/24/how-is-a-url-structured/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.