What is a URL?

By Hemanta Sundaray on 2022-11-27

A URL (Unique Resource Locator) is the address of a unique resource on the web.

It is composed of different parts. Here is an example:

Components of a URL


A protocol is a set of methods for exchanging or transferring data around a computer network. Usually, for websites, the protocol is HTTPS or HTTP (unsecured version).


The hostname is separated from the protocol by the character pattern ://. The hostname indicates which web server is being requested.


The port indicates the technical “gate” used to access resources on the web server. If we omit the port, port 80 is assumed for HTTP and 443 for HTTPS. In general, if you are not using port 80 or 443, you should use a port number greater than 1023. It’s common to use easy-to-remember port numbers like 3000, 8080, & 8088. Note that only one server can be associated with a given port.


The path is part of the request URL after the hostname & port number. So, in a request to http://localhost:5000/posts, the path is /posts.


The query string is an optional collection of name/value pairs. They appear at the end of the path in URLs. The query string starts with a question mark (?) and name/value pairs are separated by ampersands (&).

Join the Newsletter