A url consists of a protocol, domain name, and sometimes a path and file name.

URL stands for Uniform Resource Locator, which is another term for the address of a website or resource on it. It not only indicates the location of the resource (page, video, file, etc) online, but also gives information on the query being request, page number, or even architecture of a website. A simple web address will have a minimum of 3 parts (like https://medium.com) or up to 9 in the case of a complex URL. The 9 parts of a URL are the protocol (or scheme), subdomain, domain name, top level domain, port, path, query, parameters, and fragment.

Structure of a complex URL

Complex URL Structure
  • https://

The protocol, also known as the scheme, is the first part of a URL. It represents the sets of rules that decide how files are displayed, formatted, or transferred across the web. For example, when an address is entered in the browser, the http part , which stands for hypertext transfer protocol, tells it that the page is to be displayed in hypertext format (HTML). Other protocols include the file transfer protocol (ftp) for transferring files and single mail transfer protocol (SMTP) for used by mail servers to send emails. By the way, https is the secure version of http.

The subdomain. The most common subdomain is ‘www’ which a general symbol for any resource on the web. However, it is common to specify the type of resource that the browser should deliver. In the case of the URL above, we can see that the type of data that is being requested from the server is a for videos.

The domain name is the actual name of the website. The ‘medium’ in ‘medium.com’ or ‘google’ in ‘google.com’. Domain names must be unique as they literally determine the address of a website. In the early days of the web, you actually had to type the IP address to go to a particular site. Later on, words were used instead as they were easier to remember.

The top level domain (TLD) is also known as the domain extension. It is the ‘com’ that appears at the end of simple websites addresses like bing.com. This part specifies what kind of content will be on the website. ‘.com’ was primarily used for commercial sites (although today it’s used to indicate any website), whereas ‘.org’ is usually used to indicate that the website is that of an organization. When it comes to buying a domain, the domain extension can decide how expensive it is. For instance, ‘.vegas’ tends to be more expensive than ‘.com’ or ‘.net’. In the example above, the ‘.co.uk’ is the top level domain.

The port is a reserved channel used for specific purposes. Different types of servers will use different ports. Web server ports differ from file server ports, for instance. The default port for standard HTTP servers is 80, whereas secure websites use HTTPS which requires port number 443. Browsers are required to connect to a particular port in order to access the resources on that server.

The path used to show which directory on server stores the resources (files, videos, audio, etc.) that are being requested. Nowadays, the path that appears in most URLs these days don’t forcibly reflect the directory structure on the server. Instead, paths are used to identify a route in the navigational structure of the website. For example, when you edit a page on Medium, the path structure is https://medium.com/p/some_number/edit. The term ‘edit’ in the URL indicates that this is the page where you edit your blogs. In the URL above, the path has something to do with playing a video, hence ‘videoplay’.

The query. Many times when searching on a website or search engine, you’ll see a question mark in the URL of the page that display your results. On google.com, if you search for keyword, you’ll see a ‘/search?’ added after the ‘.com’. The question mark tell the browser that a query is being performed against a database where the data is stored.

  • n

The parameters are the actual values being queried when a search is performed. The parameter can be search term, a number, an encrypted value or any other data that can be found on the database. Copy and paste the following address to your browser’s address bar to see shoes:https://www.amazon.com/s?k=shoes

Finally, the fragment, is an optional component of a web address that is preceded by a hash and that directs to a secondary resources, which can a portion of a page like a footer or sidebar. Often times, the fragment will be an idattribute of an HTML element.

In some cases, the URL format may follow the structure in the diagram below. Such is the case for a user’s main page on medium.com. Mine for instance is: https://medium.com/@joseph.pyram

Structure of a URL

Structure of a URL: Wikimedia Commons

Although the structure of a web address might seem trivial to the casual onlooker, they are actual important for search engine optimization (SEO) and for enhancing user experience (UX). Feel free to check out the websites below for more details on the topic.

What does a URL consist of?

What are the parts of a URL? A URL consists of five parts: the scheme, subdomain, top-level domain, second-level domain, and subdirectory.

What is the domain and path of a URL?

For example, in the URL 'https://cloudflare.com/learning/', 'cloudflare.com' is the domain name, while 'https' is the protocol and '/learning/' is the path to a specific page on the website.

Does a URL contain a domain name?

While the domain is the name of the website, a URL will lead to any one of the pages within the website. Every URL contains a domain name, as well as other components needed to locate the specific page or piece of content.

Does a URL include the protocol?

A URL (Uniform Resource Locator) is a unique identifier used to locate a resource on the Internet. It is also referred to as a web address. URLs consist of multiple parts -- including a protocol and domain name -- that tell a web browser how and where to retrieve a resource.